heap

package
v0.3.1 Latest Latest
Warning

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

Go to latest
Published: Nov 21, 2024 License: MIT Imports: 1 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AdjustDown

func AdjustDown[T cmp.CompareLess[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.CompareLess[T]](heap []T, i0, n int) bool

func Fix

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

func Init

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

func Up

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

Types

type Heap

type Heap[T cmp.CompareLess[T]] []T

func New

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

func NewFromArr

func NewFromArr[T cmp.CompareLess[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)

Jump to

Keyboard shortcuts

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