You are viewing a single comment's thread. Return to all comments →
You chose maintain a fully sorted array.
The binary search is O(log n), just like the heap push/pop; but inserting in an ArrayList should be O(n).
So I don't understand how you solution doesn't time out.
Seems like cookies are disabled on this browser, please enable them to open this website
Heaps: Find the Running Median
You are viewing a single comment's thread. Return to all comments →
You chose maintain a fully sorted array.
The binary search is O(log n), just like the heap push/pop; but inserting in an ArrayList should be O(n).
So I don't understand how you solution doesn't time out.