How many passes of counting sort does a base-10 radix sort perform on the following list?
This section requires Javascript.
You are seeing this because something didn't load right. We suggest you, (a) try
refreshing the page, (b) enabling javascript if it is disabled on your browser and,
finally, (c)
loading the
non-javascript version of this page
. We're sorry about the hassle.
Radix sort performs a counting sort for each place digit present in the list. There are numbers in the list that have a value in the one’s place, the ten’s place, and the hundred’s place — therefore, there is a maximum of three places of digits that radix sort must sort using the counting sort subroutine.
Another way to think about this is:
1 0 4 is the largest number in the list, therefore, 1 0 4 is the k value. To determine the number of digits needed to represent k (and therefore, all the numbers less than k ), use the following formula: d = ⌊ ( lo g b ( k ) + 1 ) ⌋ . Plugging in, we get d = ⌊ ( lo g 1 0 ( 1 0 4 ) + 1 ) ⌋ = 3 .