Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/sanjid133/go-collections

Implement data structure using golang generics
https://github.com/sanjid133/go-collections

data-structures golang

Last synced: about 2 months ago
JSON representation

Implement data structure using golang generics

Awesome Lists containing this project

README

        

## Implement following data structure using golang generics
- stack
- queue
- set

### Stack
A stack is a data structure that follows the LIFO (last in, first out) principle.

Implemented methods are:
- Push : add an element to the top of the stack
- Pop : remove the top element from the stack
- Top : return the top element of the stack
- IsEmpty : return true if the stack is empty, false otherwise
- Len : return the number of elements in the stack

### Queue
A queue is a data structure that follows the FIFO (first in, first out) principle.

Implemented methods are:
- Push : add an element to the back of the queue
- Pop : remove the front element from the queue
- Front : return the front element of the queue
- Back : return the back element of the queue
- IsEmpty : return true if the queue is empty, false otherwise
- Len : return the number of elements in the queue

### Set
A set is a data structure that contains a collection of unique elements.

Implemented methods are:
- Insert : add an element to the set
- Remove : remove an element from the set
- Contains : return true if the element is in the set, false otherwise
- IsEmpty : return true if the set is empty, false otherwise
- Len : return the number of elements in the set

## Installation
To install the package, run the following command:
```
go get github.com/sanjid133/go-collections
```