[Home]Pigeonhole sort

HomePage | Recent Changes | Preferences

Showing revision 2
Pigeonhole sorting takes linear time, which is the best possible performance for a sort algorithm since one has to look at all of the objects to be sorted. However, it requires

The algorithm works as follows.

  1. Set up an array of initially empty "pigeonholes" the size of the range.
  2. Go over the original array, putting each object in its pigeonhole.
  3. Iterate over the pigeonhole array in order, and put elements from non-empty holes back into the original array.

The hidden constant for this algorithm depends critically on the size of the pigeonhole array. If it is too big, steps 1 and 3 will significantly slow down the algorithm.

someone provide (pseudo)code?


HomePage | Recent Changes | Preferences
This page is read-only | View other revisions | View current revision
Edited November 22, 2001 12:42 am by Seb (diff)
Search: