Questions: Sorting Lower Bounds and Non-Comparison Sorts

5 questions to test your understanding

Score: 0 / 5
Question 1 Multiple Choice

A developer claims to have written a comparison-based sorting algorithm with O(n) worst-case runtime. What does the decision-tree lower bound tell you about this claim?

AIt's plausible if the algorithm avoids redundant comparisons cleverly
BIt's impossible — any comparison-based sort requires Ω(n log n) comparisons in the worst case
CIt's possible only for nearly-sorted inputs
DIt depends on whether the algorithm is stable or not
Question 2 Multiple Choice

Why can't counting sort be used to sort arbitrary comparable objects, such as user-defined records sorted by a custom comparator?

ABecause counting sort is not a stable sorting algorithm
BBecause counting sort requires knowing the integer key range [0, k] in advance, not just a comparison function
CBecause counting sort's space complexity makes it impractical for large objects
DBecause counting sort runs in O(n + k) which is slower than O(n log n) for large n
Question 3 True / False

The Ω(n log n) sorting lower bound proves that no sorting algorithm can run faster than O(n log n) in the worst case.

TTrue
FFalse
Question 4 True / False

The decision-tree argument works because a binary tree of height d has at most 2^d leaves, and a correct sorting algorithm must be able to produce any of the n! permutations of the input.

TTrue
FFalse
Question 5 Short Answer

Explain why radix sort requires a *stable* sub-sort at each digit position. What goes wrong if an unstable sort is used?

Think about your answer, then reveal below.