Protected
_pqProtected
_priorityThe function returns the size of a priority queue.
The size of the priority queue.
The offer
function adds an element to a priority queue with an optional priority value.
The element
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
element being offered to the heap. If the element
parameter is a number, then the priority
parameter is set to
the value of element
. If the element
parameter is not a number, then the
The offer
method returns the instance of the Heap
class.
if priority is not a valid number
Generated using TypeDoc
The constructor initializes a PriorityQueue with a comparator function that compares the priority of two HeapItem objects.