Rolling Median Sort
Maintain the median of a sliding window using two heaps while the window moves over a stream.
4 notes
Maintain the median of a sliding window using two heaps while the window moves over a stream.
Maintain the median of a stream using a max heap and a min heap.
Find the largest or smallest k elements without sorting the full input, using a heap or partition-based approach.
Build a max-heap in place, then repeatedly extract the maximum to produce a sorted array in O(n log n) worst-case time.