queue

package
v0.0.0-...-9dec8c7 Latest Latest
Warning

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

Go to latest
Published: Sep 7, 2020 License: MIT Imports: 0 Imported by: 0

Documentation

Index

Examples

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Queue

type Queue []interface{}

An FIFO queue.

func (*Queue) IsEmpty

func (q *Queue) IsEmpty() bool

Returns if the queue is empty or not.

func (*Queue) Pop

func (q *Queue) Pop() int

Pops elements from head.

Example
q := Queue{1}
q.Push(2)
q.Push(3)
fmt.Println(q.Pop())
fmt.Println(q.Pop())
fmt.Println(q.IsEmpty())

fmt.Println(q.Pop())
fmt.Println(q.IsEmpty())
Output:

1
2
false
3
true

func (*Queue) Push

func (q *Queue) Push(v int)

Pushes the element into the queue. e.g. q.Push(123)

Jump to

Keyboard shortcuts

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