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.
The val parameter represents the value that you want to add to the heap. It can be of any
type.
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
The add method returns the instance of the Heap class.
if priority is not a valid number
Starting from TypeScript version 5.0 and onwards, the use of distinct access modifiers for Getters and Setters is not permitted. As an alternative, to ensure compatibility, it is necessary to adopt a Java-style approach for Setters (using the same name as the property) while utilizing separate method names for Getters.
Starting from TypeScript version 5.0 and onwards, the use of distinct access modifiers for Getters and Setters is not permitted. As an alternative, to ensure compatibility, it is necessary to adopt a Java-style approach for Setters (using the same name as the property) while utilizing separate method names for Getters.
Starting from TypeScript version 5.0 and onwards, the use of distinct access modifiers for Getters and Setters is not permitted. As an alternative, to ensure compatibility, it is necessary to adopt a Java-style approach for Setters (using the same name as the property) while utilizing separate method names for Getters.
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.
Generated using TypeDoc
The constructor initializes a PriorityQueue with a comparator function that compares the priority of two HeapItem objects.