Optional options: HeapOptions<T>The options parameter is an optional object that can be passed to the constructor. It is of
type HeapOptions<T>, which is a generic type that represents the options for the heap.
Protected _pqProtected _priorityThe function returns the size of a priority queue.
The size of the priority queue.
The add function adds an val to a priority queue with an optional priority value.
Optional priority: numberThe priority parameter is an optional number that represents the priority of the
val being added to the heap. If the val parameter is a number, then the priority parameter is set to
the value of val. If the val parameter is not a number, then the
Optional val: TThe val parameter represents the value that you want to add to the heap. It can be of any
type.
The add method returns the instance of the Heap class.
if priority is not a valid number
The function checks if a given node or value exists in the priority queue.
The parameter node can be of type T or HeapItem<T>.
a boolean value.
The peek function returns the top item in the priority queue without removing it.
Optional isItem: undefinedThe peek() method is returning either a HeapItem<T> object or null.Returns an val with the highest priority in the queue
The peek function returns the top item in the priority queue without removing it.
The peek() method is returning either a HeapItem<T> object or null.Returns an val with the highest priority in the queue
The peek function returns the top item in the priority queue without removing it.
The peek() method is returning either a HeapItem<T> object or null.Returns an val with the highest priority in the queue
The peekLast function returns the last item in the heap.
Optional isItem: undefinedThe method peekLast() returns either a HeapItem<T> object or null.Returns an val with the lowest priority in the queue
The peekLast function returns the last item in the heap.
The method peekLast() returns either a HeapItem<T> object or null.Returns an val with the lowest priority in the queue
The peekLast function returns the last item in the heap.
The method peekLast() returns either a HeapItem<T> object or null.Returns an val with the lowest priority in the queue
The poll function returns the top item from a priority queue or null if the queue is empty.Removes and returns an val with the highest priority in the queue
Optional isItem: undefinedeither a HeapItem
The poll function returns the top item from a priority queue or null if the queue is empty.Removes and returns an val with the highest priority in the queue
either a HeapItem
The poll function returns the top item from a priority queue or null if the queue is empty.Removes and returns an val with the highest priority in the queue
either a HeapItem
The function sorts the elements in the priority queue and returns either the sorted items or their values depending on the value of the isItem parameter.
Optional isItem: undefinedThe isItem parameter is a boolean flag that indicates whether the sorted result should
be an array of HeapItem<T> objects or an array of the values (T) of those objects. If isItem is true, the
sorted result will be an array of HeapItem @returns an array of either HeapItem, null, T, or undefined` values.
The function sorts the elements in the priority queue and returns either the sorted items or their values depending on the value of the isItem parameter.
The isItem parameter is a boolean flag that indicates whether the sorted result should
be an array of HeapItem<T> objects or an array of the values (T) of those objects. If isItem is true, the
sorted result will be an array of HeapItem @returns an array of either HeapItem, null, T, or undefined` values.
The function sorts the elements in the priority queue and returns either the sorted items or their values depending on the value of the isItem parameter.
The isItem parameter is a boolean flag that indicates whether the sorted result should
be an array of HeapItem<T> objects or an array of the values (T) of those objects. If isItem is true, the
sorted result will be an array of HeapItem @returns an array of either HeapItem, null, T, or undefined` values.
The toArray function returns an array of HeapItem<T> objects.
Optional isItem: undefinedAn array of HeapItem
The toArray function returns an array of HeapItem<T> objects.
An array of HeapItem
The toArray function returns an array of HeapItem<T> objects.
An array of HeapItem
Generated using TypeDoc
The constructor initializes a PriorityQueue with a custom comparator function.