You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
But in order to do that without changing the interface we need to add another structure to keep track of the relation: item -> position in the heap and the code can get a little convoluted, but I'll put some thought into it.
I think this can be achieved by overloading _swap to capture swaps (in order to update positions to pass to _siftUp, _siftDown) and changing heap comparator so that it looks up priorities in the PriorityQueue._items rather than in a separate container.
We can do better, namely in O(log n).
The text was updated successfully, but these errors were encountered: