algorithm-archive icon indicating copy to clipboard operation
algorithm-archive copied to clipboard

implemented stack and queue in Go

Open henrikac opened this issue 3 years ago • 7 comments

This PR implements stack and queue in Go.

Note: code/go/stack-queue.goalso includes a func main where all the tests are written but I'm not sure where to include these (or if they are even required?)

henrikac avatar Nov 01 '21 11:11 henrikac

One could think about commenting that behind the declaration to make it clear to beginners what interface{} means in this context

I'm all for making comments in the code if there is some part of an algorithm that can be difficult to understand but I am not a fan of making comments describing language syntax, e.g. what T is in Array<T> in Java.

henrikac avatar Nov 02 '21 17:11 henrikac

The code is able to run with go run stack-queue.go on its own that way, that's enough. It doesn't need to be embedded somewhere.

We want to produce executables (as much as possible for all compiled languages) with the build system in construction, so I am not sure this point is valid right now.

Amaras avatar Nov 03 '21 11:11 Amaras

@Amaras Does this PR conflict with the build system?

leios avatar Nov 03 '21 15:11 leios

We haven't implemented the Go build system yet, but we need to think about the future. It doesn't conflict with anything yet, though

Amaras avatar Nov 03 '21 17:11 Amaras

@Amaras do I need to make any changes before this can get merged?

henrikac avatar Nov 08 '21 17:11 henrikac

If you can compile it down to a runnable executable, it's good for me

Amaras avatar Nov 08 '21 18:11 Amaras

go run stack-queue.go should work

henrikac avatar Nov 08 '21 19:11 henrikac