Skip to content

maxPriorityQueue<K, V>(keyOrder, entries?): BinaryPriorityQueue<K, V>

Defined in: packages/heap/src/priority-queue.ts:670

Create a max priority queue over a binary heap: the entry with the largest key per keyOrder is at the root, and pop extracts in descending key order.

K

V

Order<K>

Total ordering over the keys.

Iterable<readonly [K, V], any, any>

Optional initial [key, value] pairs, in iteration order.

BinaryPriorityQueue<K, V>

const pq = maxPriorityQueue(numberOrder, [[5, 'a'], [1, 'b'], [3, 'c']])
pq.peek() // 'a'

With code DUPLICATE_VALUE when entries carries one value twice.