525 views
1 votes
1 votes
Suppose we radix sort n words of b bits each. Each could be viewed as having (b/r) digits or r bits each. for some integer r

now fill in the blanks

a)Each part of radix sort takes _________ time

2) At min r= _______

3)T(n,b)= ____________

1 Answer

0 votes
0 votes

a. Each digit can have 2r values. So each part of radix sort will take time O(n+2r). 

b. In general the time complexity will be O((b/r)(n+2r)). To minimize this complexity r should be equal to b. If r=b , then complexity will be equal to O(n+2b) = O(n) which is optimal. (This answer is by assuming you want the value of r at optimal or minimal runtime).

c. If r>= logn then T(n,b) = O(bn/logn), else T(n,b) = O(n).  This holds for all b>= n.

Please refer text in TH Cormen book after 8.4 Lemma.

 

Related questions

1 votes
1 votes
1 answer
3
akash.dinkar12 asked Jun 28, 2019
755 views
Let $X$ be a random variable that is equal to the number of heads in two flips of a fair coin. What is $E[X^2]$? What is $E^2[X]$?
1 votes
1 votes
1 answer
4
akash.dinkar12 asked Jun 28, 2019
680 views
Explain why the worst-case running time for bucket sort is $\Theta(n^2)$. What simple change to the algorithm preserves its linear average-case running time and makes its...