Data Structures & AlgorithmsHardTCS NQT · sorting
Problem: Which property makes counting sort stable and therefore usable inside radix sort?
- A. It places equal keys in the order they appear in the input
- B. It sorts the keys in place
- C. It uses comparisons only
- D. It uses random pivots
Correct answer: A. It places equal keys in the order they appear in the input
A stable pass preserves the relative order of equal keys from the previous digit, which radix sort relies on.
More Coding Interview Problems questions
- Problem: Which structure gives a queue with O(1) amortised enqueue, dequeue and minimum queries?
- Problem: The Chinese remainder theorem gives a unique solution modulo M for a system of congruences under which condition?
- Problem: What guarantee does the maximal-matching heuristic give for vertex cover?
- Problem: Which problem is the standard application of the monotonic deque?
- Problem: What is the expected number of random probes needed in open-addressing hashing with load factor alpha under uniform probing…
- Problem: What is the complexity of checking whether a number n is prime by trial division up to sqrt(n)?