-
Effekt Library
- heap
- Heap
- heap
- heap
- internal
- left
- right
- parent
- bubbleUp
- sinkDown
- insert
- findMin
- deleteMin
- size
- heap Jump to source: libraries/common/heap.effekt
- Heap
[T] (rawContents: ResizableArray[T], cmp: (T, T) => Ordering at {}) - heap
[T] (cmp: (T, T) => Ordering at {}) - heap
[T] (cmp: (T, T) => Ordering at {}, capacity: Int) - internal
- left
(idx: Int) - right
(idx: Int) - parent
(idx: Int) - bubbleUp
[A] (heap: Heap[A], idx: Int) - sinkDown
[A] (heap: Heap[A], idx: Int) - insert
[T] (heap: Heap[T], value: T): Unit / {} - findMin
[T] (heap: Heap[T]): T / {Exception[OutOfBounds]} - deleteMin
[T] (heap: Heap[T]): T / {Exception[OutOfBounds]} - size
[T] (heap: Heap[T]): Int / {}
Example usage: examples/stdlib/heap
Resizable 2-ary min-heap, backed by a resizable array `cmp` defines the ordering of elements
Make a new Heap with the given comparison operation
Make a new Heap with the given comparison operation and initial capacity
Insert value into heap O(log n) worst case if capacity suffices, O(1) average
find and return (but not remove) the minimal element in this heap panics when heap is empty O(1)
find and remove the minimal element in this heap panics when heap is empty O(log n)
Number of elements in the heap O(1)