Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Fix ¶
Fix re-establishes the heap ordering after the element at index i has changed its value. Changing the value of the element at index i and then calling Fix is equivalent to, but less expensive than, calling Remove(h, i) followed by a Push of the new value. The complexity is O(log n) where n = h.Len().
func Heapify ¶
Heapify establishes the heap invariants required by the other routines in this package. Init is idempotent with respect to the heap invariants and may be called whenever the heap invariants may have been invalidated.
Types ¶
type PriorityQueue ¶
A PriorityQueue implements heap.Interface and holds Items.
func (PriorityQueue[T]) Len ¶
func (pq PriorityQueue[T]) Len() int
func (PriorityQueue[T]) Less ¶
func (pq PriorityQueue[T]) Less(i, j int) bool
func (*PriorityQueue[T]) Pop ¶
func (pq *PriorityQueue[T]) Pop() any
func (*PriorityQueue[T]) Push ¶
func (pq *PriorityQueue[T]) Push(x any)
func (PriorityQueue[T]) Swap ¶
func (pq PriorityQueue[T]) Swap(i, j int)
Click to show internal directories.
Click to hide internal directories.