import { BinaryHeap } from "https://deno.land/std@0.159.0/collections/mod.ts";
A priority queue implemented with a binary heap. The heap is in decending order by default, using JavaScript's built in comparison operators to sort the values.
Methods
clear()
Removes all values from the binary heap.
Returns an iterator for retrieving and removing values from the binary heap.
isEmpty(): boolean
Checks if the binary heap is empty.
Removes the greatest value from the binary heap and returns it, or null if it is empty.
[Symbol.iterator](): IterableIterator<T>
Static Methods
from<T>(collection: ArrayLike<T> | Iterable<T> | BinaryHeap<T>): BinaryHeap<T>
Creates a new binary heap from an array like or iterable object.
from<T>(collection: ArrayLike<T> | Iterable<T> | BinaryHeap<T>, options: { compare?: (a: T, b: T) => number; }): BinaryHeap<T>
from<T, U, V>(collection: ArrayLike<T> | Iterable<T> | BinaryHeap<T>, options: { compare?: (a: U, b: U) => number; map: (value: T, index: number) => U; thisArg?: V; }): BinaryHeap<U>