Questions: Linear-Time Sorting: Counting Sort and Radix Sort

5 questions to test your understanding

Score: 0 / 5
Question 1 Multiple Choice

You have 10 million employee records, each with a department code from 0 to 999. Which algorithm is most efficient for sorting by department code, and why?

AMerge sort — it's stable and handles any key type
BQuicksort — it's faster in practice than merge sort
CCounting sort — the key range is small and no comparisons are needed
DHeapsort — it guarantees O(n log n) in all cases
Question 2 Multiple Choice

A student argues that radix sort's O(d(n+b)) time complexity means it is always faster than merge sort's O(n log n). What is wrong with this claim?

ARadix sort is not stable, which limits its practical use
BRadix sort requires O(n²) auxiliary space
Cd can be large enough that d(n+b) exceeds n log n, and radix sort only works on keys with a known, finite structure — unlike merge sort
DRadix sort's average case degrades to O(n log n), matching merge sort
Question 3 True / False

Counting sort and radix sort can achieve linear time only because they do not sort by comparing pairs of elements.

TTrue
FFalse
Question 4 True / False

Radix sort achieves correct results by sorting from the most significant digit to the least significant digit.

TTrue
FFalse
Question 5 Short Answer

Why is stability a requirement for radix sort to produce correct results?

Think about your answer, then reveal below.