The tightest lower bound on the number of comparisons, in the worst case, for comparison-based sorting is of the order of
View worked solution
Answer: C
The worst-case lower bound for any comparison-based sorting algorithm can be established using the decision tree model.
For an input sequence of distinct elements, there are possible permutations. Any comparison-based sorting algorithm must be able to distinguish between all of these permutations to correctly sort the input.
In a binary decision tree representing the comparisons:
- Each internal node represents a comparison between two elements.
- Each leaf node represents a unique sorted permutation of the input.
- If the height of the decision tree is , the maximum number of leaves it can have is .
To successfully sort all possible inputs, the number of leaves must be at least the number of permutations:
Taking the logarithm (base 2) on both sides:
Using Stirling's approximation, we know that:
Thus, the minimum height (which represents the worst-case number of comparisons) is of the order of . Therefore, the tightest lower bound is of the order of .
Free practice · Your answers on this page are not saved.
