Documentation
¶
Overview ¶
Package heap provides the implementation of a generic binary heap.
Index ¶
- type CompareFunc
- type Heap
- func (h *Heap[K, V]) Clear()
- func (h *Heap[K, V]) Get(key K) (value V, ok bool)
- func (h *Heap[K, V]) Has(key K) bool
- func (h *Heap[K, V]) Len() int
- func (h *Heap[K, V]) Peek() (key K, value V, ok bool)
- func (h *Heap[K, V]) Pop() (key K, value V, ok bool)
- func (h *Heap[K, V]) Push(key K, value V)
- func (h *Heap[K, V]) Remove(key K) (value V, ok bool)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type CompareFunc ¶
CompareFunc compares a and b and returns 1, 0 or -1 if a is greater than b, a is equal to b, or a is smaller than b, respectively.
type Heap ¶
type Heap[K comparable, V any] struct { // contains filtered or unexported fields }
Heap is a binary heap that stores items in an ascending order.
func New ¶
func New[K comparable, V any](cmp CompareFunc[V]) *Heap[K, V]
New instantiates a new heap.
Click to show internal directories.
Click to hide internal directories.