max_heap

package
v0.0.0-...-6deb688 Latest Latest
Warning

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

Go to latest
Published: Nov 1, 2023 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrEmptyHeap    = errors.New("empty heap")
	ErrInvalidIndex = errors.New("index does not exists in the heap")
)

Functions

This section is empty.

Types

type Heap

type Heap[T cmp.Ordered] struct {
	// contains filtered or unexported fields
}

func NewHeap

func NewHeap[T cmp.Ordered]() *Heap[T]

func NewHeapWCapacity

func NewHeapWCapacity[T cmp.Ordered](capacity int) *Heap[T]

func (*Heap[T]) Insert

func (h *Heap[T]) Insert(value T)

func (*Heap[T]) Peek

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

func (*Heap[T]) Remove

func (h *Heap[T]) Remove() (T, error)

func (*Heap[T]) RemoveIndex

func (h *Heap[T]) RemoveIndex(index int) (T, error)

func (*Heap[T]) Values

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

func (*Heap[T]) ValuesSorted

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

Jump to

Keyboard shortcuts

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