Documentation
¶
Overview ¶
Package heap is a generic heap implementation.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Heap ¶
type Heap[T any] struct { // contains filtered or unexported fields }
func Make ¶
MakeHeap makes a heap. For a max heap, functional parameter 'less' must return true when item a < b and false otherwise. For a min heap, 'less' must return true when item a > b and false otherwise. 'cap' is the capcity guess of the maximum size of the heap and follows the same rules a capacity for a slice.
func (*Heap[T]) Peek ¶
Peek returns the top of the heap and true if there are items in the heap. It returns false when there are no items in the heap. Its runs in constant time.
Click to show internal directories.
Click to hide internal directories.