heap

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Sep 10, 2022 License: MIT Imports: 3 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[V any] struct {
	// contains filtered or unexported fields
}

func From

func From[V any](data []V, cmp structs.CompareFunc[V]) *Heap[V]

func FromHeapSlice

func FromHeapSlice[V any](data []V, cmp structs.CompareFunc[V]) *Heap[V]

func FromOrdered

func FromOrdered[V constraints.Ordered](data []V) *Heap[V]

func FromOrderedHeapSlice

func FromOrderedHeapSlice[V constraints.Ordered](data []V) *Heap[V]

func New

func New[V any](cmp structs.CompareFunc[V]) *Heap[V]

func NewCap

func NewCap[V any](capacity int, cmp structs.CompareFunc[V]) *Heap[V]

func NewOrdered

func NewOrdered[V constraints.Ordered]() *Heap[V]

func NewOrderedCap

func NewOrderedCap[V constraints.Ordered](capacity int) *Heap[V]

func (*Heap[V]) Clear

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

func (*Heap[V]) Contains

func (h *Heap[V]) Contains(value V) bool

func (*Heap[V]) Index

func (h *Heap[V]) Index(value V) int

func (*Heap[V]) IsEmpty

func (h *Heap[V]) IsEmpty() bool

func (*Heap[V]) Peek

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

func (*Heap[V]) Pop

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

func (*Heap[V]) Push

func (h *Heap[V]) Push(value V)

func (*Heap[V]) Remove

func (h *Heap[V]) Remove(value V) bool

func (*Heap[V]) RemoveIndex

func (h *Heap[V]) RemoveIndex(i int) V

func (*Heap[V]) SetCapFunc

func (h *Heap[V]) SetCapFunc(capFn structs.CapacityFunc)

func (*Heap[V]) Size

func (h *Heap[V]) Size() int

func (*Heap[V]) Update

func (h *Heap[V]) Update(oldValue, newValue V) bool

func (*Heap[V]) UpdateIndex

func (h *Heap[V]) UpdateIndex(i int, newValue V)

func (*Heap[V]) Values

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

type Iterator

type Iterator[V any] struct {
	// contains filtered or unexported fields
}

func (*Iterator[V]) HasNext

func (i *Iterator[V]) HasNext() bool

func (*Iterator[V]) Next

func (i *Iterator[V]) Next() V

func (*Iterator[V]) Remove

func (i *Iterator[V]) Remove()

Jump to

Keyboard shortcuts

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