updateTop

fun updateTop(value: Long): Long

Replace the top of the pq with newTop. Should be called when the top value changes. Still log(n) worst case, but it's at least twice as fast to

pq.updateTop(value);
*

instead of

pq.pop();
pq.push(value);
*

Calling this method on an empty LongHeap has no visible effect.

Return

the new 'top' element after shuffling the heap.

Parameters

value

the new element that is less than the current top.