GATE IT 2008 · Heap Sort & Non-Comparison Sorts

MCQ · 2 marks · Problem PROG-SORT-0047

If we use Radix Sort with decimal digits (base 10) to sort \(n\) integers in the range \(\left(n^{k/2}, n^{k}\right]\), for some \(k>0\) which is independent of \(n\), the time taken would be
  1. A
    \(\Theta(n)\)
  2. B
    \(\Theta(kn)\)
  3. C
    \(\Theta(n \log n)\)
  4. D
    \(\Theta(n^2)\)

Solve it on GATE DA practice →More Searching & Sorting Algorithms problems

Show the worked solution\[\boxed{T=d\cdot\Theta(n+b)}\]Here \(b=10\) and \(d\), the number of decimal digits, lies between \(\tfrac{k}{2}\log_{10}n\) and \(k\log_{10}n\), so \(d=\Theta(\log n)\) for constant \(k\).\(T=\Theta(\log n)\cdot\Theta(n)=\Theta(n\log n)\).(A) and (B) would need a base of about \(n\) (then \(d\approx k\) passes and \(\Theta(kn)=\Theta(n)\)); with a fixed base the number of passes grows like \(\log n\).Answer: C

GATE DA practice: past exam problems by chapter, with worked solutions · gatedaprep.com