2-3. Consider the radix sort for a sequence of N decimal numbers, where the numbers range from 0 to X-1. What is the least number of decimal digits needed to represent all the numbers in this range?
Answer:
3. Cont. It can be proved that the time complexity of the radix sort is best when we perform the counting sort on a group of (log base X of N) digits, instead of a single digit, at a time from the least significant bits to the most significant bits. In this case, what will be the run time complexity of the radix sort (in terms of N and X)?
Hints: Remember that the time complexity for the counting sort is O(N+K), where K is the range of the numbers. In this case, K = 10 log base X of N = N.
a) O(N log X / log N)
b) O(X log X / log N)
c) O(N log N / log X)
d) None