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 ?

  1. A.

    O(n)

  2. B.

    O(n log n)

  3. C.

    O(n2)

  4. 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.

Explore the full course: Tpsc Assistant Technical Officer