queue

package
v0.0.0-...-61cd50e Latest Latest
Warning

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

Go to latest
Published: May 5, 2020 License: Apache-2.0 Imports: 0 Imported by: 1

Documentation

Index

Examples

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type IntQueue

type IntQueue []int

IntQueue 使用别名方式扩充slice实现整型队列

func (*IntQueue) IsEmpty

func (q *IntQueue) IsEmpty() bool

IsEmpty 队列是否为空

func (*IntQueue) Pop

func (q *IntQueue) Pop() int

Pop 出队

func (*IntQueue) Push

func (q *IntQueue) Push(v int)

Push 入队

e.g. q.Push(123)
Example

ExampleIntQueue_Push 是对 IntQueue 的 Push() 方法的示例, 测试时会检查注释中的 Output 是否正确, godoc 中也会展示在 Example 区。

q := IntQueue{1}
q.Push(12)
q.Push(22)
fmt.Println(q.IsEmpty())
fmt.Println(q.Pop())
Output:

false
1

Jump to

Keyboard shortcuts

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