# Algorithms | Sorting | Question 13

The tightest lower bound on the number of comparisons, in the worst case, for comparison-based sorting is of the order of

**(A)** N

**(B)** N^2

**(C)** NlogN

**(D)** N(logN)^2

**Answer:** **(C)** **Explanation:** The number of comparisons that a comparison sort algorithm requires increases in proportion to Nlog(N), where N is the number of elements to sort. This bound is asymptotically tight:

Given a list of distinct numbers (we can assume this because this is a worst-case analysis), there are N factorial permutations exactly one of which is the list in sorted order. The sort algorithm must gain enough information from the comparisons to identify the correct permutations. If the algorithm always completes after at most f(N) steps, it cannot distinguish more than 2^f(N) cases because the keys are distinct and each comparison has only two possible outcomes. Therefore,

2^f(N) >= N! or equivalently f(N) >= log(N!).

Since log(N!) is Omega(NlogN), the answer is NlogN.

For more details, read here

## Recommended Posts:

- Algorithms | Sorting | Question 20
- Algorithms | Sorting | Question 3
- Algorithms | Sorting | Question 15
- Algorithms | Sorting | Question 23
- Algorithms | Sorting | Question 2
- Algorithms | Sorting | Question 1
- Algorithms | Sorting | Question 14
- Algorithms | Sorting | Question 9
- Algorithms | Sorting | Question 4
- Algorithms | Sorting | Question 16
- Algorithms | Sorting | Question 23
- Algorithms | Sorting | Question 19
- Algorithms | Sorting | Question 18
- Algorithms | Sorting | Question 7
- Algorithms | Sorting | Question 17