Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Item ¶
type Item[A any] interface { comparable // Less returns true if this item is less than the given item. Less(A) bool }
type MinHeap ¶
type MinHeap[A Item[A]] struct { // contains filtered or unexported fields }
MinHeap is a min heap of items.
func NewMinHeap ¶
NewMinHeap returns a new min heap.
func (*MinHeap[A]) Insert ¶
func (h *MinHeap[A]) Insert(item A)
Insert inserts the given item into the heap.
func (*MinHeap[A]) Remove ¶
func (h *MinHeap[A]) Remove() A
Remove removes the smallest item from the heap and returns it.
func (*MinHeap[A]) RemoveItem ¶
func (h *MinHeap[A]) RemoveItem(item A)
Click to show internal directories.
Click to hide internal directories.