queue

package
v0.0.0-...-cfe842a Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 6, 2016 License: Apache-2.0 Imports: 1 Imported by: 0

Documentation

Overview

Package queue implements queue data strcuture.

The basic operations on a queue are `Enqueue`, which inserts an element at the end, and `Dequeue`, which deletes an element at the start.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Queue

type Queue struct {
	// contains filtered or unexported fields
}

Queue declaration

func New

func New() *Queue

New creates a new queue with nil value

func (*Queue) IsEmpty

func (q *Queue) IsEmpty() bool

IsEmpty checks if queue is empty

func (*Queue) Length

func (q *Queue) Length() int

Length returns how many elements are in queue

func (*Queue) Peek

func (q *Queue) Peek() interface{}

Peek return the first element

func (*Queue) Pop

func (q *Queue) Pop() (interface{}, error)

Pop removes an element from the start of queue and return it

func (*Queue) Push

func (q *Queue) Push(element interface{})

Push append an element to the end of queue

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL