heap

package module
v0.0.0-...-f377607 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Greater

func Greater[T cmp.Ordered](d []T, i, j int) bool

func Less

func Less[T cmp.Ordered](d []T, i, j int) bool

Types

type Heap

type Heap[T any] struct {
	Data []T

	Less LessFunc[T]
	Swap SwapFunc[T]
	// contains filtered or unexported fields
}

func New

func New[T any](less LessFunc[T]) *Heap[T]

func (*Heap[T]) Del

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

func (*Heap[T]) Down

func (h *Heap[T]) Down(i int) bool

func (*Heap[T]) Fix

func (h *Heap[T]) Fix(i int) bool

func (*Heap[T]) Init

func (h *Heap[T]) Init(d []T) bool

func (*Heap[T]) Len

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

func (*Heap[T]) Pop

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

func (*Heap[T]) Push

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

func (*Heap[T]) Up

func (h *Heap[T]) Up(i int) bool

type LessFunc

type LessFunc[T any] func(d []T, i, j int) bool

type Stateless

type Stateless[T any] struct{}

func (Stateless[T]) Del

func (h Stateless[T]) Del(d []T, i int, less LessFunc[T]) []T

func (Stateless[T]) Down

func (h Stateless[T]) Down(d []T, i int, less LessFunc[T]) bool

func (Stateless[T]) Fix

func (h Stateless[T]) Fix(d []T, i int, less LessFunc[T]) bool

func (Stateless[T]) Init

func (h Stateless[T]) Init(d []T, less LessFunc[T]) bool

func (Stateless[T]) Pop

func (h Stateless[T]) Pop(d []T, less LessFunc[T]) (T, []T)

func (Stateless[T]) PopFrom

func (h Stateless[T]) PopFrom(d *[]T, less LessFunc[T]) T

func (Stateless[T]) Push

func (h Stateless[T]) Push(d []T, e T, less LessFunc[T]) []T

func (Stateless[T]) PushTo

func (h Stateless[T]) PushTo(d *[]T, e T, less LessFunc[T])

func (Stateless[T]) Up

func (h Stateless[T]) Up(d []T, i int, less LessFunc[T]) bool

type StatelessSwap

type StatelessSwap[T any] struct{}

func (StatelessSwap[T]) Del

func (h StatelessSwap[T]) Del(d []T, i int, less LessFunc[T], swap SwapFunc[T]) []T

func (StatelessSwap[T]) Down

func (h StatelessSwap[T]) Down(d []T, i int, less LessFunc[T], swap SwapFunc[T]) bool

func (StatelessSwap[T]) Fix

func (h StatelessSwap[T]) Fix(d []T, i int, less LessFunc[T], swap SwapFunc[T]) bool

func (StatelessSwap[T]) Init

func (h StatelessSwap[T]) Init(d []T, less LessFunc[T], swap SwapFunc[T]) bool

func (StatelessSwap[T]) Pop

func (h StatelessSwap[T]) Pop(d []T, less LessFunc[T], swap SwapFunc[T]) (T, []T)

func (StatelessSwap[T]) PopFrom

func (h StatelessSwap[T]) PopFrom(d *[]T, less LessFunc[T], swap SwapFunc[T]) T

func (StatelessSwap[T]) Push

func (h StatelessSwap[T]) Push(d []T, e T, less LessFunc[T], swap SwapFunc[T]) []T

func (StatelessSwap[T]) PushTo

func (h StatelessSwap[T]) PushTo(d *[]T, e T, less LessFunc[T], swap SwapFunc[T])

func (StatelessSwap[T]) Up

func (h StatelessSwap[T]) Up(d []T, i int, less LessFunc[T], swap SwapFunc[T]) bool

type SwapFunc

type SwapFunc[T any] func(d []T, i, j int)

Jump to

Keyboard shortcuts

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