GATE / CS ARCHIVE

GATE CSE 1992 / QUESTION 2(ix)

Linear sorting in a polynomial key range

Algorithms · Searching, Sorting & Selection · Full GATE CSE 1992 paper

GATE 1992, Q2(ix) MSQ
Report issue

Searching, Sorting & Selection

Question 2(ix), GATE 1992: Which listed method sorts n integers in [1, n³] in O(n): heapsort, quicksort, mergesort, radix sort?
Question 2(ix), GATE 1992: Which listed method sorts n integers in [1, n³] in O(n): heapsort, quicksort, mergesort, radix sort?
Tap to enlarge
Select all that apply
Answer & solution

Answer: D: radix sort (no official key was published)

Subtract one to put keys in [0, n³−1], then represent each in base n using three digits. Stable counting sort of one digit takes O(n+n)=O(n) time and O(n) auxiliary storage, so three least-significant-digit passes remain linear. Comparison sorts retain their general Ω(n log n) worst-case comparison barrier on arbitrary distinct keys; the integer representation lets radix sorting escape that model. The bound assumes word operations and digit extraction on these O(log n)-bit keys take constant time.

Original paper, page 2