queue

package
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: Aug 31, 2022 License: GPL-3.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ArrayQueue

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

数组队列的局限性:出队列的操作时间复杂度为 n

func NewArrayQueue

func NewArrayQueue(capacity int) *ArrayQueue

func (*ArrayQueue) Capacity

func (arrayQueue *ArrayQueue) Capacity() int

func (*ArrayQueue) Dequeue

func (arrayQueue *ArrayQueue) Dequeue() interface{}

func (*ArrayQueue) Enqueue

func (arrayQueue *ArrayQueue) Enqueue(e interface{})

func (*ArrayQueue) Front

func (arrayQueue *ArrayQueue) Front() interface{}

func (*ArrayQueue) IsEmpty

func (arrayQueue *ArrayQueue) IsEmpty() bool

func (*ArrayQueue) Size

func (arrayQueue *ArrayQueue) Size() int

func (*ArrayQueue) String

func (arrayQueue *ArrayQueue) String() string

type IQueue

type IQueue interface {
	Size() int
	IsEmpty() bool
	Enqueue(interface{})
	Dequeue() interface{}
	Front() interface{}
}

Queue 先进先出

type LinkedListQueue

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

func NewLinkedListQueue

func NewLinkedListQueue() *LinkedListQueue

func (*LinkedListQueue) Dequeue

func (linkedListQueue *LinkedListQueue) Dequeue() interface{}

func (*LinkedListQueue) Enqueue

func (linkedListQueue *LinkedListQueue) Enqueue(e interface{})

func (*LinkedListQueue) Front

func (linkedListQueue *LinkedListQueue) Front() interface{}

func (*LinkedListQueue) IsEmpty

func (linkedListQueue *LinkedListQueue) IsEmpty() bool

func (*LinkedListQueue) Size

func (linkedListQueue *LinkedListQueue) Size() int

func (*LinkedListQueue) String

func (linkedListQueue *LinkedListQueue) String() string

type LoopQueue

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

LoopQueue 循环队列

func NewLoopQueue

func NewLoopQueue(capacity int) *LoopQueue

func (*LoopQueue) Capacity

func (loopQueue *LoopQueue) Capacity() int

func (*LoopQueue) Dequeue

func (loopQueue *LoopQueue) Dequeue() (e interface{})

获得队列头部元素

func (*LoopQueue) Enqueue

func (loopQueue *LoopQueue) Enqueue(e interface{})

入队

func (*LoopQueue) Front

func (loopQueue *LoopQueue) Front() interface{}

查看队列头部元素

func (*LoopQueue) IsEmpty

func (loopQueue *LoopQueue) IsEmpty() bool

func (*LoopQueue) Size

func (loopQueue *LoopQueue) Size() int

func (*LoopQueue) String

func (loopQueue *LoopQueue) String() string

Jump to

Keyboard shortcuts

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