Median from a data stream

I recently came across an interesting question : “Find Median from Data Stream”

The problem allows one to think of multiple concepts:

[1] Run-time complexity of adding in number to the data structure v/s finding median from the data structure

[2] can we leverage some form of counting sort algo

[3] what kinds of data structures might be useful useful –  heaps, segment trees, AVL etc etc

[4] I sensed some parallels with the range-minimum query problem as well.




The run-times are not great, but then I was not using any libraries.I wonder what optimizations other folks are doing to improve runtime.





Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s