-- import "github.com/vedhavyas/queue"
type Queue struct {}
Queue represents the FIFO list of items
func (q *Queue) Dequeue() (interface{}, error)
Dequeue returns the first item from queue: O(1)
Returns an error if queue empty/out of bounds
func (q *Queue) Enqueue(item interface{})
Enqueue add the item to the queue: O(1)
func (q *Queue) Get(i int) (interface{}, error)
Get returns the item at the given index from the list: O(n)
Returns an error if queue empty/out of bounds
func (q *Queue) Len() int
Len returns the items count in the queue
func (q *Queue) Peak() (interface{}, error)
Peak returns the next value in queue but does not remove from queue: O(1)
Returns error if queue empty
func (q *Queue) PeakAt(i int) (interface{}, error)
PeakAt returns the item at the index i from the queue: O(n)
Returns error if queue empty/out of bounds
func (q *Queue) String() string
String dumps the queue in human readable format: O(n)