minheap

package
v1.3.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 1, 2026 License: MIT Imports: 1 Imported by: 0

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, V any] []entry[K, V]

A Heap is a minimum heap ordered by key.

func (*Heap[K, V]) Clear

func (h *Heap[K, V]) Clear()

Clear removes all elements from the heap.

func (Heap[K, V]) Empty

func (h Heap[K, V]) Empty() bool

func (Heap[K, V]) Len

func (h Heap[K, V]) Len() int

func (Heap[K, V]) Peek

func (h Heap[K, V]) Peek() (K, V)

Peek returns the smallest element in the heap. It must not be called when the heap is empty.

func (*Heap[K, V]) Pop

func (h *Heap[K, V]) Pop() (K, V)

Pop removes and returns the smallest element in the heap. It must not be called when the heap is empty.

func (*Heap[K, V]) Push

func (h *Heap[K, V]) Push(key K, value V)

Push adds an element to the heap.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL
⌂ 换网址