https://github.com/rayyildiz/ds
Data structures in Go
https://github.com/rayyildiz/ds
data-structures deprecated golang will-delete
Last synced: 2 months ago
JSON representation
Data structures in Go
- Host: GitHub
- URL: https://github.com/rayyildiz/ds
- Owner: rayyildiz
- License: mit
- Archived: true
- Created: 2015-04-12T13:35:02.000Z (almost 11 years ago)
- Default Branch: main
- Last Pushed: 2021-02-04T21:04:55.000Z (about 5 years ago)
- Last Synced: 2025-08-13T21:39:17.103Z (8 months ago)
- Topics: data-structures, deprecated, golang, will-delete
- Language: Go
- Homepage:
- Size: 8.79 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Data structures with [Go](http://golang.org)
[](https://travis-ci.org/rayyildiz/ds)
[](https://ci.appveyor.com/project/rayyildiz/ds)
[](https://coveralls.io/r/rayyildiz/ds?branch=master)
[](https://goreportcard.com/report/github.com/rayyildiz/ds)
[](http://godoc.org/github.com/rayyildiz/ds)
To get this examples
go get -u go.rayyildiz.dev/ds
### Stack
[Stack](http://en.wikipedia.org/wiki/Stack_(abstract_data_type)) is a data type that implementation of LIFO (Last In First Out)
A stack has two important method :
* _Push_ Insert an element to stack
* _Pop_ Remove the top of the element from stack.
Here is usage of stack
stack := NewStack()
stack.Push("One")
stack.Push("Two")
elem, err := stack.Pop() // elem = "Two" and err = nil
### Queue
[Queue](http://en.wikipedia.org/wiki/Queue_(abstract_data_type)) is a data type that implementation of FIFO (First In, First Out)
A queue has two important method :
* _Enqueue_ Insert an element to queue
* _Dequeue_ Remove the first element from queue
Here is usage of stack
q := NewQueue()
q.Enqueue("One")
q.Enqueue("Two")
elem, err := q.Dequeue() // elem = "One" and err = nil
### Linked List
Simple implementation of [linked-list](https://en.wikipedia.org/wiki/Linked_list)
Currently 2 method implemented:
* _Insert_ Insert a new element to linked list
* _Count_ Number of elements.
Here is usage of linked list
list := NewLinkedList()
list.Insert(3)
list.Insert("hello")
list.Insert(3.14)
list.Insert(true)