News for hackers. Stuff that matters.
Re:Find running median from a stream of integers by raymondh on Tuesday May 22, 2012 @01:49AM (#4006430)
Too bad that a horrible answer was selected as the best. The minheap/maxheap solution requires that the entire stream of integers be stored in memory.

There is a fast and memory efficient solution using Indexable Skiplists: http://code.activestate.com/recipes/576930-efficient-running...

In a n-sized sliding window, only the most recent n elements need to be stored (not the entire data stream). The skiplist insertions, deletions, and indexed lookups are all O(log n).

There are no comments on this comment yet.