Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type PriorityQueue ¶
type PriorityQueue[T comparable] struct { // contains filtered or unexported fields }
PriorityQueue represents an unbounded priority queue based on a priority heap. It implements heap.Interface.
func NewPriorityQueue ¶
func NewPriorityQueue[T cmp.Ordered](maxHeap bool, items ...T) *PriorityQueue[T]
func NewPriorityQueueWith ¶ added in v0.3.1
func NewPriorityQueueWith[T comparable](maxHeap bool, cmp comparator.Comparable[T], items ...T) *PriorityQueue[T]
NewPriorityQueue initializes and returns an Queue, default min heap.
func (*PriorityQueue[T]) Clear ¶
func (pq *PriorityQueue[T]) Clear()
Clear removes all the elements from this priority queue.
func (*PriorityQueue[T]) IsEmpty ¶
func (pq *PriorityQueue[T]) IsEmpty() bool
IsEmpty returns true if this list contains no elements.
func (*PriorityQueue[T]) Len ¶
func (pq *PriorityQueue[T]) Len() int
Len returns the length of this priority queue.
func (*PriorityQueue[T]) Peek ¶
func (pq *PriorityQueue[T]) Peek() (val T, exist bool)
Peek retrieves, but does not remove, the head of this queue, or return nil if this queue is empty.
func (*PriorityQueue[T]) Pop ¶ added in v0.3.0
func (pq *PriorityQueue[T]) Pop() (val T, exist bool)
Pop retrieves and removes the head of the this queue, or return nil if this queue is empty.
func (*PriorityQueue[T]) Push ¶ added in v0.3.0
func (pq *PriorityQueue[T]) Push(item T)
Push inserts the specified element into this priority queue.
Click to show internal directories.
Click to hide internal directories.