pq

package
v0.3.8-dev-trailers Latest Latest
Warning

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

Go to latest
Published: Oct 1, 2015 License: MIT Imports: 1 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Elem

type Elem interface {
	// SetIndex stores the int index.
	SetIndex(int)
	// Index returns the last given by SetIndex(int).
	Index() int
}

Elem describes elements that can be added to the PQ. Clients must implement this interface.

type ElemComparator

type ElemComparator func(a, b Elem) bool

ElemComparator returns true if pri(a) > pri(b)

type PQ

type PQ interface {
	// Push adds the ele
	Push(Elem)
	// Pop returns the highest priority Elem in PQ.
	Pop() Elem
	// Len returns the number of elements in the PQ.
	Len() int
	// Update `fixes` the PQ.
	Update(index int)
}

PQ is a basic priority queue.

func New

func New(cmp ElemComparator) PQ

New creates a PQ with a client-supplied comparator.

Jump to

Keyboard shortcuts

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