The maximum number of comparisons needed to sort 9 items using radix sort is…
2018
The maximum number of comparisons needed to sort 9 items using radix sort is (assume each item is 5 digit octal number) :
- A.
45
- B.
72
- C.
360
- D.
450
Attempted by 115 students.
Show answer & explanation
Correct answer: C
Answer: 360
Explanation:
There are 5 digits per item (each digit is octal).
Each octal digit can take 8 values (0–7), so there are 8 buckets per pass.
If the bucket for an item is found by checking bucket labels sequentially (a naive approach), an item may require up to 8 comparisons to find its bucket in the worst case.
So worst-case comparisons = number of passes × items × comparisons per item = 5 × 9 × 8 = 360.
Note: Radix sort itself is a non-comparative technique. The 360 figure counts comparisons in a naive bucket-selection implementation (linear search among bucket labels). If buckets are accessed directly (constant-time mapping), these comparisons would not be needed.
A video solution is available for this question — log in and enroll to watch it.