A heap of data
Isabel M. Beichl, Frank Sullivan · IEEE Computational Science and Engineering · 1996
Previously, we described a fast method for selecting from a list at random, biased by predetermined rates or probabilities (see ibid., vol.2, p.13, 1996). However, sometimes "probabilistically next" is not good enough. What if we have some criterion or priority for selecting from the list? For this type of problem we can introduce the heap, a data structure that allows us to keep track of the maximum or the minimum dynamically. Heaps are an effective way of maintaining a priority queue. They are also good for sorting.