UnShuffle sort

(algorithm)

Definition:
A distribution sort with two phases. In the first phase, the inputs are distributed among doubly-ended queues keeping the items in each queue ordered and creating a new queue when there is no place on an existing queue. The second phase is an ideal merge in which the item to be removed is determined by keeping the queues in a priority queue.

Note:
The doubly-ended queue with ordered items is called a pile. The UnShuffle algorithm is the most efficient available for sorting data streams that exhibit low entropy, i.e., are already mostly sorted or contains runs of sorted elements. The run time is (N) for sorted input. The general case is (K/2)*N + NlogK where K is the entropy of the input and is manifest in the number of piles generated during the distribution phase.