Skip to content

minBinaryHeap<A>(order, items?): BinaryHeap<A>

Defined in: packages/heap/src/binary-heap.ts:341

Create a min binary heap: the smallest element per order is at the root, and pop extracts in ascending order.

A

Order<A>

Total ordering over the elements.

Iterable<A, any, any>

Optional initial elements, in iteration order.

BinaryHeap<A>

const heap = minBinaryHeap(numberOrder, [30, 1, 50, 20])
heap.peek() // 1