alg

package
v1.2.1 Latest Latest
Warning

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

Go to latest
Published: Jul 30, 2017 License: Apache-2.0 Imports: 1 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Index

type Index interface {
	Index(int) (int, bool)
}

type Queue

type Queue interface {
	Index
	Clear()
	Push(int)
	Enqueue(int)
	Dequeue() (int, bool)
	Pop() (int, bool)
	Peek() (int, bool)
	Size() int

	Copy() Queue
	Equal(Queue) bool
}

type QueueSlice

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

func NewQueueSlice

func NewQueueSlice(size int) *QueueSlice

func (*QueueSlice) Clear

func (q *QueueSlice) Clear()

func (*QueueSlice) Copy

func (q *QueueSlice) Copy() Queue

func (*QueueSlice) Dequeue

func (q *QueueSlice) Dequeue() (int, bool)

func (*QueueSlice) Enqueue

func (q *QueueSlice) Enqueue(val int)

func (*QueueSlice) Equal

func (q *QueueSlice) Equal(other Queue) bool

func (*QueueSlice) Index

func (q *QueueSlice) Index(index int) (int, bool)

func (*QueueSlice) Peek

func (q *QueueSlice) Peek() (int, bool)

func (*QueueSlice) Pop

func (q *QueueSlice) Pop() (int, bool)

Pop is mapped to the top of the queue, so it acts like a dequeue

func (*QueueSlice) Push

func (q *QueueSlice) Push(val int)

func (*QueueSlice) Size

func (q *QueueSlice) Size() int

type Stack

type Stack interface {
	Index
	Clear()
	Push(int)
	Pop() (int, bool)
	Peek() (int, bool)
	Size() int

	Copy() Stack
	Equal(Stack) bool
}

type StackArray

type StackArray struct {
	Array []int
}

func NewStackArray

func NewStackArray(size int) *StackArray

func (*StackArray) Clear

func (s *StackArray) Clear()

func (*StackArray) Copy

func (s *StackArray) Copy() Stack

func (*StackArray) Equal

func (s *StackArray) Equal(other Stack) bool

func (*StackArray) Index

func (s *StackArray) Index(index int) (int, bool)

func (*StackArray) Peek

func (s *StackArray) Peek() (int, bool)

func (*StackArray) Pop

func (s *StackArray) Pop() (int, bool)

func (*StackArray) Push

func (s *StackArray) Push(val int)

func (*StackArray) Size

func (s *StackArray) Size() int

Directories

Path Synopsis
Package heap provides heap operations for any type that implements heap.Interface.
Package heap provides heap operations for any type that implements heap.Interface.

Jump to

Keyboard shortcuts

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