Skip to content

kevinpollet/go-datastructures

Repository files navigation

Go Data Structures

GoDoc Go Report Card

Project to keep track of my learnings and experiments while learning the Go programming language and reviewing the common Abstract Data Types (ADT), data structures, and algorithms.

Installation

$ go get github.com/kevinpollet/go-datastructures

Abstract Data Types & Data Structures

List

type List interface {
	Add(value interface{})
	Clear()
	Get(index int) (interface{}, error)
	IndexOf(value interface{}) int
	Insert(index int, value interface{}) error
	IsEmpty() bool
	Remove(index int) (interface{}, error)
	Size() int
}

Stack

type Stack interface {
	Clear()
	IsEmpty() bool
	Peek() (interface{}, error)
	Pop() (interface{}, error)
	Push(value interface{})
	Size() int
}

Queue

type Queue interface {
	Clear()
	IsEmpty() bool
	Offer(value interface{})
	Peek() (interface{}, error)
	Poll() (interface{}, error)
	Size() int
}

Dequeue / Double-ended Queue

type Dequeue interface {
	Clear()
	IsEmpty() bool
	OfferFirst(value interface{})
	OfferLast(value interface{})
	PeekFirst() (interface{}, error)
	PeekLast() (interface{}, error)
	PollFirst() (interface{}, error)
	PollLast() (interface{}, error)
	Size() int
}

PriorityQueue

type PriorityQueue interface {
	Clear()
	IsEmpty() bool
	Offer(value interface{}, priority int)
	Peek() (interface{}, error)
	Poll() (interface{}, error)
	Size() int
}

Readings & Lectures

License

MIT