pq

package
v0.1.4 Latest Latest
Warning

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

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

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

PriorityQueue is a priority queue implemented with max heap.

func NewPriorityQueue

func NewPriorityQueue() *PriorityQueue

NewPriorityQueue creates an instance of NewPriorityQueue.

func (*PriorityQueue) Len

func (pq *PriorityQueue) Len() int

Len is the number of elements in this PriorityQueue.

func (*PriorityQueue) Peek

func (pq *PriorityQueue) Peek() Value

Peek returns the maximum element from this PriorityQueue.

func (*PriorityQueue) Pop

func (pq *PriorityQueue) Pop() Value

Pop removes and returns the maximum element from this PriorityQueue.

func (*PriorityQueue) Push

func (pq *PriorityQueue) Push(value Value)

Push pushes the element x onto this PriorityQueue.

func (*PriorityQueue) Release

func (pq *PriorityQueue) Release(value Value)

Release deletes the given value from this PriorityQueue.

func (*PriorityQueue) Values

func (pq *PriorityQueue) Values() []Value

Values returns the values of this PriorityQueue.

type Value

type Value interface {
	Less(other Value) bool
}

Value represents the data stored by PriorityQueue.

Jump to

Keyboard shortcuts

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