Documentation
¶
Overview ¶
Package queue implements a priority queue.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Entry ¶
type Entry struct { Value interface{} Priority uint64 // contains filtered or unexported fields }
Entry is a PriorityQueue entry.
type PriorityQueue ¶
type PriorityQueue struct {
// contains filtered or unexported fields
}
PriorityQueue is a priority queue instance.
func (*PriorityQueue) DequeueRandom ¶
func (q *PriorityQueue) DequeueRandom(r *rand.Rand) *Entry
DequeueRandom removes a random entry from the queue.
func (*PriorityQueue) Enqueue ¶
func (q *PriorityQueue) Enqueue(priority uint64, value interface{})
Enqueue inserts the provided value, into the queue with the specified priority.
func (*PriorityQueue) Len ¶
func (q *PriorityQueue) Len() int
Len returns the current length of the priority queue.
func (*PriorityQueue) Peek ¶
func (q *PriorityQueue) Peek() *Entry
Peek returns the 0th entry (lowest priority) if any, leaving the PriorityQueue unaltered. Callers MUST NOT alter the Priority of the returned entry.
func (*PriorityQueue) Pop ¶
func (q *PriorityQueue) Pop() *Entry
Pop removes and returns the 0th entry (lowest priority) if any.
Click to show internal directories.
Click to hide internal directories.