Popular recipes tagged "median" and "structure" but not "advanced_data_structure"http://code.activestate.com/recipes/tags/median-advanced_data_structure+structure/2011-04-19T15:00:57-07:00ActiveState Code RecipesRetrieving the median of a set in constant time (Python)
2011-04-19T15:00:57-07:00jimmy2timeshttp://code.activestate.com/recipes/users/4177690/http://code.activestate.com/recipes/577661-retrieving-the-median-of-a-set-in-constant-time/
<p style="color: grey">
Python
recipe 577661
by <a href="/recipes/users/4177690/">jimmy2times</a>
(<a href="/recipes/tags/data/">data</a>, <a href="/recipes/tags/heap/">heap</a>, <a href="/recipes/tags/median/">median</a>, <a href="/recipes/tags/python/">python</a>, <a href="/recipes/tags/retrieving/">retrieving</a>, <a href="/recipes/tags/structure/">structure</a>).
Revision 2.
</p>
<p>Provides a data structure for a queue of integers whose get() method returns the median element. The interface is similar to the standard Queue module, with an added method top() to retrieve the median without removing it.</p>