https://github.com/le-michael/simple
A compilation of simple data-structures written in go
https://github.com/le-michael/simple
data-structures go golang
Last synced: 9 months ago
JSON representation
A compilation of simple data-structures written in go
- Host: GitHub
- URL: https://github.com/le-michael/simple
- Owner: le-michael
- License: apache-2.0
- Created: 2018-08-01T23:29:07.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2018-08-23T03:23:24.000Z (over 7 years ago)
- Last Synced: 2025-01-23T00:12:15.222Z (11 months ago)
- Topics: data-structures, go, golang
- Language: Go
- Size: 21.5 KB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
[](https://goreportcard.com/report/github.com/le-michael/simple) [](https://travis-ci.org/le-michael/simple) [](https://coveralls.io/github/le-michael/simple?branch=master)
# simple
A compilation of simple data-structures written in go
## Why?
Golang is a great language but it's missing some basic data structures. I made this package so I won't have to have to reimplement all these data structures.
The code is also simple to read for anyone trying to get themselves familiar with Go.
## Usage
### Stack
Example
```Go
package main
import (
"fmt"
"github.com/le-michael/simple"
)
func main() {
stack := simple.NewStack()
for i := 0; i < 10; i++ {
stack.Push(i)
}
for !stack.Empty() {
fmt.Println(stack.Top())
stack.Pop()
}
// 9 8 7 6 5 4 3 2 1 0
}
```
### Queue
Example
```Go
package main
import (
"fmt"
"github.com/le-michael/simple"
)
func main() {
queue := simple.NewQueue()
for i := 0; i < 10; i++ {
queue.Push(i)
}
for !queue.Empty() {
fmt.Println(queue.Front())
queue.Pop()
}
// 0 1 2 3 4 5 6 7 8 9
}
```