heap

package
v0.3.3 Latest Latest
Warning

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

Go to latest
Published: Nov 26, 2024 License: MIT, Apache-2.0 Imports: 1 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AdjustDown

func AdjustDown[T cmp.Comparable[T]](heap []T, i int)

与Down一致,不同的写法

func AdjustUp

func AdjustUp[T cmp.Comparable[T]](heap []T, i int)

与Up一致,不同的写法

func Down

func Down[T cmp.Comparable[T]](heap []T, i0, n int) bool

func Fix

func Fix[T cmp.Comparable[T]](heap []T, i int)

func Init

func Init[T cmp.Comparable[T]](heap []T)

func Up

func Up[T cmp.Comparable[T]](heap []T, j int)

Types

type Heap

type Heap[T cmp.Comparable[T]] []T

func New

func New[T cmp.Comparable[T]](l int) Heap[T]

func NewFromArray

func NewFromArray[T cmp.Comparable[T]](arr []T) Heap[T]

func (Heap[T]) First

func (heap Heap[T]) First() (T, bool)

func (Heap[T]) Init

func (heap Heap[T]) Init()

func (Heap[T]) Last

func (heap Heap[T]) Last() (T, bool)

func (*Heap[T]) Pop

func (heap *Heap[T]) Pop() (T, bool)

func (*Heap[T]) Push

func (heap *Heap[T]) Push(x T)

func (*Heap[T]) Remove

func (heap *Heap[T]) Remove(i int) (T, bool)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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