algorithm-archive
algorithm-archive copied to clipboard
implemented stack and queue in Go
This PR implements stack and queue in Go.
Note: code/go/stack-queue.go
also 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?)
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.
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 Does this PR conflict with the build system?
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 do I need to make any changes before this can get merged?
If you can compile it down to a runnable executable, it's good for me
go run stack-queue.go
should work