Skip to content

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

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

Create a max binary heap: the largest element per order is at the root, and pop extracts in descending order.

A

Order<A>

Total ordering over the elements.

Iterable<A, any, any>

Optional initial elements, in iteration order.

BinaryHeap<A>

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