heap

package
v0.7.1 Latest Latest
Warning

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

Go to latest
Published: Apr 22, 2024 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrHeapEmpty = errors.New("heap is empty")

Functions

This section is empty.

Types

type Heap

type Heap[K cmp.Ordered, V any] struct {
	// contains filtered or unexported fields
}

func NewHeap

func NewHeap[K cmp.Ordered, V any](ht HeapType) *Heap[K, V]

func (*Heap[K, V]) Len

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

func (*Heap[K, V]) Peak

func (h *Heap[K, V]) Peak() (K, V, bool)

func (*Heap[K, V]) Pop

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

func (*Heap[K, V]) Push

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

type HeapType

type HeapType int
const (
	MinHeapType HeapType = iota
	MaxHeapType
)

Jump to

Keyboard shortcuts

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