What is the worst-case running time of the Quick Sort algorithm?

2021

What is the worst-case running time of the Quick Sort algorithm?

  1. A.

    Θ(n)

  2. B.

    Θ(n²)

  3. C.

    Θ(n log n)

  4. D.

    Θ(n log² n)

Attempted by 416 students.

Show answer & explanation

Correct answer: B

Instead of dividing the array roughly in half, each partition leaves one subarray of size n−1 :

T(n)=T(n−1)+(n−1)

Solving this recurrence gives:

1+2+3+⋯+(n−1)=O(n2)

Explore the full course: Up Lt Grade Assistant Teacher 2025