heap

package
v0.0.0-...-9899634 Latest Latest
Warning

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

Go to latest
Published: Jul 16, 2025 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DefaultCapacity = 10
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Comparator

type Comparator[T any] func(t1, t2 T) int

func NaturalOrder

func NaturalOrder[T cmp.Ordered]() Comparator[T]

func Reversed

func Reversed[T any](comparator Comparator[T]) Comparator[T]

type Config

type Config[T any] struct {
	// contains filtered or unexported fields
}

type Heap

type Heap[T any] struct {
	// contains filtered or unexported fields
}

func Max

func Max[T cmp.Ordered]() *Heap[T]

func Min

func Min[T cmp.Ordered]() *Heap[T]

func New

func New[T any](opts ...Option[T]) *Heap[T]

func (*Heap[T]) Add

func (h *Heap[T]) Add(t T)

func (*Heap[T]) AddAll

func (h *Heap[T]) AddAll(sequence iter.Seq[T])

func (*Heap[T]) All

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

func (*Heap[T]) Empty

func (h *Heap[T]) Empty() bool

func (*Heap[T]) Peek

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

func (*Heap[T]) Remove

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

func (*Heap[T]) Size

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

type Option

type Option[T any] func(config *Config[T])

func WithComparator

func WithComparator[T any](comparator Comparator[T]) Option[T]

Jump to

Keyboard shortcuts

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