You are viewing a single comment's thread. Return to all comments →
Be careful, adding an element to an ArrayList is O(n) This means that your solution is not O(n log n)
Correct me if i'm wrong
Using a well implemented heap (or two in that exercise) u can actually run with a time complexity of O(logn)
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 →
Be careful, adding an element to an ArrayList is O(n) This means that your solution is not O(n log n)
Correct me if i'm wrong
Using a well implemented heap (or two in that exercise) u can actually run with a time complexity of O(logn)