heap

package
v0.0.0-...-8d8fcf7 Latest Latest
Warning

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

Go to latest
Published: Oct 24, 2018 License: MIT Imports: 1 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Item

type Item struct {
	Value interface{} // Payload
	// contains filtered or unexported fields
}

Item -- the items held in the priority queue

type MaxIntHeap

type MaxIntHeap []int

MaxIntHeap -- Min heap containing integers

func (MaxIntHeap) Len

func (h MaxIntHeap) Len() int

func (MaxIntHeap) Less

func (h MaxIntHeap) Less(i, j int) bool

func (*MaxIntHeap) Pop

func (h *MaxIntHeap) Pop() interface{}

Pop -- removes an element from the heap

func (*MaxIntHeap) Push

func (h *MaxIntHeap) Push(x interface{})

Push -- adds an element to the heap

func (MaxIntHeap) Swap

func (h MaxIntHeap) Swap(i, j int)

type MinIntHeap

type MinIntHeap []int

MinIntHeap -- Min heap containing integers

func (MinIntHeap) Len

func (h MinIntHeap) Len() int

func (MinIntHeap) Less

func (h MinIntHeap) Less(i, j int) bool

func (*MinIntHeap) Pop

func (h *MinIntHeap) Pop() interface{}

Pop -- removes an element from the heap

func (*MinIntHeap) Push

func (h *MinIntHeap) Push(x interface{})

Push -- adds an element to the heap

func (MinIntHeap) Swap

func (h MinIntHeap) Swap(i, j int)

type PriorityQueue

type PriorityQueue []*Item

PriorityQueue -- Generic PriorityQueue

func (PriorityQueue) Len

func (pq PriorityQueue) Len() int

Len -- returns the length of the Priority Queue

func (PriorityQueue) Less

func (pq PriorityQueue) Less(i, j int) bool

Less -- Defines what it means for one item to be less than another

func (*PriorityQueue) Pop

func (pq *PriorityQueue) Pop() interface{}

Pop -- Pops the item with the highest priority from the queue

func (*PriorityQueue) Push

func (pq *PriorityQueue) Push(x interface{})

Push -- Pushes an item to the priority queue

func (PriorityQueue) Swap

func (pq PriorityQueue) Swap(i, j int)

Swap -- Defines what it means to swap two items in the Priority Queue

func (*PriorityQueue) Update

func (pq *PriorityQueue) Update(item *Item, value interface{}, priority int)

Update -- Update an item in the queue

Jump to

Keyboard shortcuts

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