heap

package
v0.0.0-...-381c4e2 Latest Latest
Warning

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

Go to latest
Published: Apr 23, 2024 License: MIT Imports: 7 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 schnittstellen.FuncIter[TPtr],
) (err error)

func MergeStreamPreferringHeap

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

Types

type Element

type Element interface{}

type ElementPtr

type ElementPtr[T Element] interface {
	schnittstellen.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 schnittstellen.Equaler1[TPtr],
	lessor schnittstellen.Lessor3[TPtr],
	resetter schnittstellen.Resetter2[T, TPtr],
) *Heap[T, TPtr]

func MakeHeapFromSlice

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

func MakeHeapFromSliceUnsorted

func MakeHeapFromSliceUnsorted[T Element, TPtr ElementPtr[T]](
	equaler schnittstellen.Equaler1[TPtr],
	lessor schnittstellen.Lessor3[TPtr],
	resetter schnittstellen.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]) Copy

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

func (*Heap[T, TPtr]) Each

func (a *Heap[T, TPtr]) Each(f schnittstellen.FuncIter[T]) (err error)

func (*Heap[T, TPtr]) EachPtr

func (a *Heap[T, TPtr]) EachPtr(f schnittstellen.FuncIter[TPtr]) (err error)

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]) GetEqualer

func (h *Heap[T, TPtr]) GetEqualer() schnittstellen.Equaler1[TPtr]

func (*Heap[T, TPtr]) GetLessor

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

func (*Heap[T, TPtr]) GetResetter

func (h *Heap[T, TPtr]) GetResetter() schnittstellen.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 schnittstellen.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