GATE DA 2026 | Question 15

Programming, Data Structures and Algorithms › Sorting · MCQ · 1 mark · Answer: D

  1. Question 15Programming, Data Structures and Algorithmsmcq1 mark
    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?
    • A.
    • B.
    • C.
    • D.
      ✓

    Answer: D

    Solution

    The input is in random order, so the first element is equally likely to be any rank. If the pivot is the -th smallest, the two subarrays have sizes and , each with probability . Averaging over all pivot positions and adding linear partition time:
    This solves to . (A) is the worst case, and (B) and (C) assume fixed split ratios, which is not the expected case. Answer: (D).

More GATE PYQ on Sorting

All GATE DA Programming, Data Structures and Algorithms PYQ →

Attempt GATE DA 2026 in real GATE exam mode

Full paper with a timer, the GATE interface and a topic-wise analysis — free.

Create free account →