GATE DA 2026 · Question 15 · Programming, Data Structures and Algorithms · Multiple choice (MCQ) · 1 mark · −1/3 for a wrong answer

Consider that the quick sort algorithm is used to sort an array of n distinct randomly ordered elements. In every call, the pivot is chosen as the first element of the current subarray.
Let T(n) denote the expected time to sort the array. Assume that the time to partition is linear in the size of the current subarray.
Which of the following recurrence relations correctly represents T(n) in this scenario?

  1. (A) T(n) = T(1) + T(n-1) + O(n)
  2. (B) T(n) = T(n/4) + T(3n/4) + O(n)
  3. (C) T(n) = 2T(n/2) + O(n)
  4. (D) T(n) = 1/nΣₖ₌₀ⁿ⁻¹[T(k) + T(n-k-1)] + O(n)
Answer

Answer (D)

Answer from the official GATE DA 2026 answer key.

The step-by-step solution, where available, is part of GATE DA Pro. See what Pro includes