Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type PriorityQueue ¶
type PriorityQueue[T constraints.Comparable[T]] struct { // contains filtered or unexported fields }
PriorityQueue is a heap based priority queue.
func New ¶
func New[T constraints.Comparable[T]]() (newPriorityQueue *PriorityQueue[T])
New creates a new PriorityQueue.
func (*PriorityQueue[T]) IsEmpty ¶
func (p *PriorityQueue[T]) IsEmpty() (isEmpty bool)
IsEmpty returns true if the PriorityQueue is empty.
func (*PriorityQueue[T]) Peek ¶
func (p *PriorityQueue[T]) Peek() (element T, success bool)
Peek returns the element with the highest priority without removing it.
func (*PriorityQueue[T]) Pop ¶
func (p *PriorityQueue[T]) Pop() (element T, success bool)
Pop removes and returns the element with the highest priority.
func (*PriorityQueue[T]) Push ¶
func (p *PriorityQueue[T]) Push(x T)
Push adds x to the PriorityQueue.
func (*PriorityQueue[T]) Size ¶
func (p *PriorityQueue[T]) Size() (size int)
Size returns the number of elements in the PriorityQueue.
Click to show internal directories.
Click to hide internal directories.