Returns an iterator for traversing the heap.
Optional
reversed: boolean = falseIf true
, the iterator will traverse the heap in reverse order.
A generator that yields heap elements in the requested order.
Clears the heap by removing all elements.
Decreases the key value of a heap element.
The element whose key value will be decreased.
The value of decrease.
true
or false
depending on the outcome of the decrease process.
Returns an iterator for traversing the heap elements.
Optional
reversed: boolean = falseIf true
, the iterator will traverse the heap in reverse order.
Increases the key value of a heap element.
The element whose key value will be increased.
The value of increase.
true
or false
depending on the outcome of the increase process.
Returns an iterator for traversing the heap element keys.
Optional
reversed: boolean = falseIf true
, the iterator will traverse the heap in reverse order.
Returns the top element of the heap or undefined
if the heap is empty.
Removes and returns the top element of the heap, or returns undefined
if the heap is empty.
Removes an element from the heap.
The element to remove.
true
or false
depending on the outcome of the removal process.
A concrete implementation of a max-heap.