Documentation
¶
Overview ¶
Package pq implements a priority queue.
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 ¶
ElemComparator returns true if pri(a) > pri(b)
type PQ ¶
type PQ interface {
// Push adds the ele
Push(Elem)
// Pop removes and returns the highest priority Elem in PQ.
Pop() Elem
// Peek returns the highest priority Elem in PQ (without removing it).
Peek() Elem
// Remove removes the item at the given index from the PQ.
Remove(index int) 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.
Click to show internal directories.
Click to hide internal directories.