heap

package
v0.0.0-...-791c77c Latest Latest
Warning

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

Go to latest
Published: May 11, 2025 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func MergeStream

func MergeStream[T Element, TPtr ElementPtr[T]](
	a *Heap[T, TPtr],
	read func() (TPtr, error),
	write interfaces.FuncIter[TPtr],
) (err error)

func MergeStreamPreferringHeap

func MergeStreamPreferringHeap[T Element, TPtr ElementPtr[T]](
	h *Heap[T, TPtr],
	r func() (TPtr, error),
	w interfaces.FuncIter[TPtr],
	equaler interfaces.Equaler[TPtr],
	l interfaces.Lessor3[TPtr],
	re interfaces.Resetter2[T, TPtr],
) (err error)

Types

type Element

type Element interface{}

type ElementPtr

type ElementPtr[T Element] interface {
	interfaces.Ptr[T]
}

type Heap

type Heap[T Element, TPtr ElementPtr[T]] struct {
	// contains filtered or unexported fields
}

func Make

func Make[T Element, TPtr ElementPtr[T]](
	equaler interfaces.Equaler[TPtr],
	lessor interfaces.Lessor3[TPtr],
	resetter interfaces.Resetter2[T, TPtr],
) *Heap[T, TPtr]

func MakeHeapFromSlice

func MakeHeapFromSlice[T Element, TPtr ElementPtr[T]](
	equaler interfaces.Equaler[TPtr],
	lessor interfaces.Lessor3[TPtr],
	resetter interfaces.Resetter2[T, TPtr],
	s []TPtr,
) *Heap[T, TPtr]

func MakeHeapFromSliceUnsorted

func MakeHeapFromSliceUnsorted[T Element, TPtr ElementPtr[T]](
	equaler interfaces.Equaler[TPtr],
	lessor interfaces.Lessor3[TPtr],
	resetter interfaces.Resetter2[T, TPtr],
	s []TPtr,
) *Heap[T, TPtr]

func (*Heap[T, TPtr]) Add

func (h *Heap[T, TPtr]) Add(sk TPtr) (err error)

func (*Heap[T, TPtr]) All

func (h *Heap[T, TPtr]) All() iter.Seq[TPtr]

func (*Heap[T, TPtr]) Any

func (h *Heap[T, TPtr]) Any() TPtr

func (*Heap[T, TPtr]) Copy

func (a *Heap[T, TPtr]) Copy() Heap[T, TPtr]

func (*Heap[T, TPtr]) Equals

func (a *Heap[T, TPtr]) Equals(b *Heap[T, TPtr]) bool

func (*Heap[T, TPtr]) Fix

func (a *Heap[T, TPtr]) Fix()

func (*Heap[T, TPtr]) GetCollection

func (h *Heap[T, TPtr]) GetCollection() interfaces.Collection[TPtr]

func (*Heap[T, TPtr]) GetEqualer

func (h *Heap[T, TPtr]) GetEqualer() interfaces.Equaler[TPtr]

func (*Heap[T, TPtr]) GetLessor

func (h *Heap[T, TPtr]) GetLessor() interfaces.Lessor3[TPtr]

func (*Heap[T, TPtr]) GetResetter

func (h *Heap[T, TPtr]) GetResetter() interfaces.Resetter2[T, TPtr]

func (*Heap[T, TPtr]) Len

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

func (*Heap[T, TPtr]) Peek

func (h *Heap[T, TPtr]) Peek() (sk TPtr, ok bool)

func (*Heap[T, TPtr]) Pop

func (h *Heap[T, TPtr]) Pop() (sk TPtr, ok bool)

func (*Heap[T, TPtr]) PopAndSave

func (h *Heap[T, TPtr]) PopAndSave() (sk TPtr, ok bool)

func (*Heap[T, TPtr]) PopError

func (h *Heap[T, TPtr]) PopError() (sk TPtr, err error)

func (*Heap[T, TPtr]) Push

func (h *Heap[T, TPtr]) Push(sk TPtr)

func (*Heap[T, TPtr]) Reset

func (a *Heap[T, TPtr]) Reset()

func (*Heap[T, TPtr]) ResetWith

func (a *Heap[T, TPtr]) ResetWith(b *Heap[T, TPtr])

func (*Heap[T, TPtr]) Restore

func (h *Heap[T, TPtr]) Restore()

func (*Heap[T, TPtr]) SetPool

func (h *Heap[T, TPtr]) SetPool(v interfaces.Pool[T, TPtr])

func (*Heap[T, TPtr]) Sorted

func (a *Heap[T, TPtr]) Sorted() (b []TPtr)

Jump to

Keyboard shortcuts

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