internal

package
v0.5.1 Latest Latest
Warning

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

Go to latest
Published: Jan 21, 2025 License: MIT Imports: 2 Imported by: 0

Documentation

Overview

Package internal contains two implementations of a binary heap, both of which draw heavy inspiration from package container/heap.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Heap

type Heap[T cmp.Ordered] []T

specialized version (for better performance)

func NewHeap

func NewHeap[T cmp.Ordered](vs []T) Heap[T]

func (Heap[T]) Iterator

func (h Heap[T]) Iterator(yield func(T) bool)

Note: in order to prevent a func literal from escaping to the heap, we deliberately design this method as an iter.Seq[T] rather than as a iter.Seq[T] factory.

type HeapFunc added in v0.5.1

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

func NewHeapFunc added in v0.5.1

func NewHeapFunc[T any](vs []T, cmp func(T, T) int) HeapFunc[T]

func (HeapFunc[T]) Iterator added in v0.5.1

func (h HeapFunc[T]) Iterator(yield func(T) bool)

Note: in order to prevent a func literal from escaping to the heap, we deliberately design this method as an iter.Seq[T] rather than as a iter.Seq[T] factory.

Jump to

Keyboard shortcuts

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