Documentation
¶
Overview ¶
Package heaps provides generic heaps.
This package provides better run speeds than the standard [heap] package.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Heap ¶
type Heap[T any] struct { // contains filtered or unexported fields }
Heap is a generic heap.
func Max ¶
func Max[T constraints.Ordered]() *Heap[T]
Max returns a new max-heap of an ordered type by its natural order.
func Min ¶
func Min[T constraints.Ordered]() *Heap[T]
Min returns a new min-heap of an ordered type by its natural order.
func (*Heap[T]) Clip ¶ added in v0.6.0
func (h *Heap[T]) Clip()
Clip removes unused capacity from the heap.
func (*Heap[T]) Fix ¶ added in v0.5.0
Fix fixes the heap after a single value had been modified. i is the index of the modified value.
func (*Heap[T]) Push ¶
func (h *Heap[T]) Push(x T)
Push adds x to h while maintaining its heap invariants.
Click to show internal directories.
Click to hide internal directories.