Documentation
¶
Overview ¶
Package priorityqueue implements an unbounded priority queue based on a priority heap. The elements of the priority queue are ordered according to their natural ordering, or by a Comparator provided at PriorityQueue construction time.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Option ¶
type Option func(q *Queue)
Option option for New.
func WithComparator ¶
func WithComparator(cmp container.Comparator) Option
WithComparator with custom Comparator. default reflect.DeepEqual
type Queue ¶
type Queue struct {
// contains filtered or unexported fields
}
Queue represents an unbounded priority queue based on a priority heap. It implements heap.Interface.
func (*Queue) Add ¶
func (sf *Queue) Add(items interface{})
Add inserts the specified element into this priority queue.
func (*Queue) Clear ¶
func (sf *Queue) Clear()
Clear removes all of the elements from this priority queue.
func (*Queue) Peek ¶
func (sf *Queue) Peek() interface{}
Peek retrieves, but does not remove, the head of this queue, or return nil if this queue is empty.