heap

package
v0.9.0 Latest Latest
Warning

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

Go to latest
Published: Nov 2, 2022 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrHeapModified = errors.New("heap modified during iteration")

Functions

This section is empty.

Types

type Heap

type Heap[T any] struct {
	// contains filtered or unexported fields
}

func New

func New[T any](less Less[T], indexChanged func(x T, i int), initial []T) Heap[T]

func (*Heap[T]) Grow

func (h *Heap[T]) Grow(n int)

func (*Heap[T]) Item

func (h *Heap[T]) Item(i int) T

func (*Heap[T]) Iterate

func (h *Heap[T]) Iterate() iterator.Iterator[T]

func (*Heap[T]) Len

func (h *Heap[T]) Len() int

func (*Heap[T]) Peek

func (h *Heap[T]) Peek() T

func (*Heap[T]) Pop

func (h *Heap[T]) Pop() T

func (*Heap[T]) Push

func (h *Heap[T]) Push(item T)

func (*Heap[T]) RemoveAt

func (h *Heap[T]) RemoveAt(i int)

func (*Heap[T]) UpdateAt

func (h *Heap[T]) UpdateAt(i int, item T)

type Less

type Less[T any] func(a, b T) bool

Duplicated from xsort to avoid dependency cycle.

Jump to

Keyboard shortcuts

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