IAE Academy

GATE 2026 DA Q.15: solution and answer

GATE 2026 · DAQ.15 · 1 mark · MCQ

Consider that the quick sort algorithm is used to sort an array of distinct randomly ordered elements. In every call, the pivot is chosen as the first element of the current subarray.

Let 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 in this scenario?

  1. (A)

  2. (B)

  3. (C)

  4. (D)

See the question in the paper

Answer and solution

ANSWER

The correct option is (D): .

Official answer: DSource: Official answer key, GATE 2026 DA (IIT Guwahati)

  1. Because the input is randomly ordered and the pivot is the first element of the current subarray, the pivot is equally likely to have any rank in that subarray. This holds again in every recursive call, because each subarray of a random permutation is itself randomly ordered.

  2. If the pivot has rank , partitioning leaves elements on the left and on the right, for . Each of these splits has probability .

  3. Partitioning scans the current subarray once, so its cost is (given in the question as linear in the subarray size).

  4. The expected time is the partition cost plus the expected cost of the two subproblems, averaged over all splits:

  5. Option (A) is a single fixed split of sizes and , the extreme case of always picking a minimum or maximum pivot. It is not an expected value. Options (B) and (C) fix the split at or , which assumes the pivot always lands at one chosen position. Only option (D) averages over every possible split with equal probability, so it is the recurrence for the expected time. The answer is (D).

KEY IDEA

An expected-time recurrence for quick sort averages over all equally likely pivot ranks. Each split has probability , and the linear partition cost is added on top.

WATCH OUT FOR

Choosing a fixed-split recurrence. Option (A) is the worst case, while (B) and (C) assume a constant-ratio split, such as the balanced split. Expected time needs the average over every split, not one assumed split.

From the GATE 2026 DA paper. Every question of this paper · Download the full paper · All 8 Design techniques questions, with notes

More Design techniques questions