This is an animation of the counting sort algorithm found in CLR's Algorithms book.

This may not work on IE, use Firefox while I work out the problem.

Array A (input array):

Array C (counting array):

Array B (output array):

PSEUDOCODE FOR COUNTING SORT (taken from CLR)

Initialize counting array to all zeros.
Count the number of times each value occurs in the input.
Modify the counting array to give the number of values smaller than index
Transfer numbers from input to output array at locations provided by counting array
 Step   CompleteStage   Restart