Lux SDKGoPackages

heap

Package heap provides heap data structure implementations.

import "github.com/luxfi/sdk/heap"

Package heap provides heap data structure implementations.

Types

Entry

Heap

Heap is used to track objects of [I] by [Val].

This data structure does not perform any synchronization and is not safe to use concurrently without external locking.

func New[I any, V cmp.Ordered](items int, isMinHeap bool) *Heap[I, V]
func (h *Heap[I, V]) First() *Entry[I, V]
func (h *Heap[I, V]) Get(id ids.ID) (*Entry[I, V], bool)
func (h *Heap[I, V]) Has(id ids.ID) bool
func (h *Heap[I, V]) Items() []*Entry[I, V]
func (h *Heap[I, V]) Len() int
func (h *Heap[I, V]) Pop() *Entry[I, V]
func (h *Heap[I, V]) Push(e *Entry[I, V])
func (h *Heap[I, V]) Remove(index int) *Entry[I, V]