What is the time complexity of the best-case scenario for Quick Sort ?
2025
What is the time complexity of the best-case scenario for Quick Sort ?
- A.
O(n)
- B.
O(n log n)
- C.
O(n2)
- D.
O(log n)
Attempted by 149 students.
Show answer & explanation
Correct answer: B
Quick Sort is a divide-and-conquer algorithm that partitions an array around a pivot element. In the best-case scenario, the pivot chosen at each step divides the array into two nearly equal halves. This balanced partitioning ensures that the recursion tree has a height of log n, and each level processes all n elements. Consequently, the total time complexity becomes O(n log n). Option A (O(n)) is incorrect because Quick Sort requires comparisons and swaps across multiple levels, not just a single pass. Option C (O(n2)) represents the worst-case scenario where partitions are highly unbalanced, not the best case. Option D (O(log n)) is too optimistic as it ignores the linear work done at each level of recursion. Therefore, O(n log n) is the correct best-case time complexity.