What is the worst-case time complexity of the standard QuickSort algorithm when the chosen pivot is consistently the smallest or largest element?

Answer and explanation

Correct answer: D. O(n²)

  1. Step 1: Analyze QuickSort partition efficiency with poor pivot selection.
  2. Step 2: When the pivot is the extreme element at every step, the partition is maximally unbalanced (size and ). The recurrence relation becomes , summing to .
Answer
O(n²).
Why not the others: is the average and best-case complexity; is tree height; is exponential complexity.

Practise more Algorithms and Python Programming.

Free questions with an explanation for every one, and full timed EmSAT Achieve (UAE) mock tests.