PQ

package
v0.0.0-...-f63f6ef Latest Latest
Warning

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

Go to latest
Published: May 15, 2021 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 InternalItem

type InternalItem struct {
	Value    interface{} // The value of the item; arbitrary.
	Priority int         // The priority of the item in the queue.
	// contains filtered or unexported fields
}

An InternalItem is something we manage in a priority queue.

type PQ_ARRAY

type PQ_ARRAY []*InternalItem

A PQ_ARRAY implements heap.Interface and holds Items.

func (PQ_ARRAY) Len

func (pq PQ_ARRAY) Len() int

func (PQ_ARRAY) Less

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

func (*PQ_ARRAY) Pop

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

func (*PQ_ARRAY) Push

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

func (PQ_ARRAY) Swap

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

type PriorityQueue

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

func New

func New() *PriorityQueue

func (*PriorityQueue) IsEmpty

func (self *PriorityQueue) IsEmpty() bool

func (*PriorityQueue) Pop

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

func (*PriorityQueue) Push

func (self *PriorityQueue) Push(v interface{}, priority int) interface{}

return internal _ITEM

func (*PriorityQueue) Update

func (self *PriorityQueue) Update(item *InternalItem, value interface{}, priority int)

Jump to

Keyboard shortcuts

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