GATE / CS ARCHIVE

GATE CSE 2004 / QUESTION 29

Comparison-sorting lower bound

Algorithms · Searching, Sorting & Selection · Full GATE CSE 2004 paper

GATE 2004, Q29 1 mark · MCQ
Report issue

Searching, Sorting & Selection

Question 29, GATE 2004: What is the tight asymptotic order of the worst-case lower bound on comparisons required by comparison-based sorting of n elements?
Options:
(A) n
(B) n²
(C) n log n
(D) n(log n)²
Tap to enlarge
Your answer
Answer & solution

Answer: C (no official key was published)

1. A comparison decision tree must distinguish n! possible input permutations, so its worst-case height is at least ceil(log2(n!))=Ω(n log n). Mergesort or heapsort attains O(n log n), making that the tight order of the worst-case comparison bound, C.

2. Teaching check: A binary comparison tree of height h has at most 2h leaves. Distinct orderings need separate leaves, so 2h≥n!. Summing logarithms or using Stirling’s estimate gives log2(n!)=Θ(n log n). This lower bound applies to comparison sorting, not every integer-key sorting method.

Original paper, page 4