Data Structures & AlgorithmsModerateTCS Digital · Infosys SP

Which lower bound holds for every comparison-based sorting algorithm in the worst case?

  1. A. Ω(n log n) comparisons, because the decision tree must have at least n! leaves
  2. B. Ω(log n!) swaps
  3. C. Ω(n) comparisons
  4. D. Ω(n²) comparisons

Correct answer: A. Ω(n log n) comparisons, because the decision tree must have at least n! leaves

A decision tree that distinguishes all n! orderings has height ≥ log₂(n!) = Θ(n log n). Non-comparison sorts (counting, radix) escape this bound by using key values directly.

More Arrays, Strings, Linked Lists, Stacks, Queues and Hashing questions

Exams that ask this topic