previous | start | next

Compute the Counts

On the k-th pass Set count[d + 1] = the number of occurrences of digit d in position k (starting at the least significant digit position - 0)

So count[1] = number of occurrences of digit 0.

This means count[0] will always be 0.

      a               count      
 0   412           0    0
 1   012           1    1
 2   101           2    2
 3   432           3    4
 4   302           4    0
 5   201           5    0
 6   410           6    0
                   .    .
                   .    .
                   9    0
   


previous | start | next