heap-js icon indicating copy to clipboard operation
heap-js copied to clipboard

remove(o) should be O(lgn) but is implemented as O(n)

Open ozyman42 opened this issue 3 years ago • 0 comments

There should be an internal map from item reference to item's index, remove the item, then heapify. Current implementation searches through the entire heap array for the element.

ozyman42 avatar Jun 28 '22 03:06 ozyman42