[http://en.wikipedia.org/wiki/Priority_queue Priority Queues] maintain a set of items along with priority values for each item. The values follow some ordering but are not unique to each item.
Nice way to build a priority queue is to use a Binary Heap.
Run [http://en.wikipedia.org/wiki/Dijkstra%27s_Algorithm Dijkstra's Algorithm] for shortest path in a graph from a starting vertex s.
Because priorities are only ever changed to become smaller, the “bubble up” procedure of the binary tree heap is helpful.
Because there are more priority changes than deletions, Dijkstra's algorithm can be sped up by optimizing the change-priority operation at the expense of the delete operation. One way to do this is to use a complete k-ary tree instead of a binary tree. Even for general binary heaps, increasing k slightly above 2 frequently results in real-world improvements due to memory locality.
For Dijkstra, total time for n vertices and m edges is $O[m \frac{1}{k} \log(n) + n \frac{k}{\log(k)} \log(n)]$. Heuristic for optimizing this is to choose k that balances the two terms… $k=\frac{m}{n}$ for total time $\frac{m \log n}{\log \frac{m}{n}}$
(Basic version) Given a set of values to be sorted:
(in-place version)
The sketch of a dynamic set of items in a Min Hash with add and remove operations:
#* Q1 contains k items with smallest hash # Want to prioritize for retrieval of item with largest hash, so it can be replaced if a smaller one is discovered #* Q2 contains remaining items # Want to find items with smallest hashes
#* if the item has a smaller hash, replace max(Q1) with the new item and place it in Q2 #* else add the new item to Q2