Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Heap ¶
type Heap[K cmp.Ordered, T comparable] struct { // contains filtered or unexported fields }
Heap is a generic min-heap implementation that allows efficient access to elements by their data value.
func NewHeap ¶
func NewHeap[K cmp.Ordered, T comparable]() *Heap[K, T]
NewHeap creates a new empty heap.
func (*Heap[K, T]) Peek ¶
Peek returns the item with the smallest key without removing it. Returns zero values and false if the heap is empty.
func (*Heap[K, T]) Pop ¶
Pop removes and returns the item with the smallest key from the heap. Returns zero values and false if the heap is empty.
Click to show internal directories.
Click to hide internal directories.