queue

package
v0.0.0-...-c234f5e Latest Latest
Warning

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

Go to latest
Published: Mar 9, 2024 License: Apache-2.0 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{}

Queue An FIFO queue.

func (*Queue) IsEmpty

func (q *Queue) IsEmpty() bool

IsEmpty Returns if the queue is empty or not.

func (*Queue) Pop

func (q *Queue) Pop() int

Pop element 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)

Push the element into the queue.

e.g.  q.Push(123)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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