Documentation
¶
Index ¶
- type Item
- type Queue
- func (pq *Queue[V, P]) Len() int
- func (pq *Queue[V, P]) Peek() V
- func (pq *Queue[V, P]) PeekPriority() P
- func (pq *Queue[V, P]) Pop() V
- func (pq *Queue[V, P]) Push(value V, priority P) *Item[V, P]
- func (pq *Queue[V, P]) Update(item *Item[V, P], value V, priority P)
- func (pq *Queue[V, P]) UpdatePriority(item *Item[V, P], priority P)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Item ¶
type Item[V any, P constraints.Ordered] struct { // contains filtered or unexported fields }
type Queue ¶
type Queue[V any, P constraints.Ordered] struct { // contains filtered or unexported fields }
Queue represents a priority queue with MINIMUM priority.
func New ¶
func New[V any, P constraints.Ordered]() Queue[V, P]
New creates a new priority queue. Not required to call.
func (*Queue[V, P]) Peek ¶
func (pq *Queue[V, P]) Peek() V
Peek returns the minimum element of the priority queue without removing it.
func (*Queue[V, P]) PeekPriority ¶
func (pq *Queue[V, P]) PeekPriority() P
Peek returns the minimum element's priority.
func (*Queue[V, P]) Pop ¶
func (pq *Queue[V, P]) Pop() V
Pop removes and returns the minimum element of the priority queue.
func (*Queue[V, P]) UpdatePriority ¶ added in v1.5.1
UpdatePriority modifies the priority of the item
Click to show internal directories.
Click to hide internal directories.