GATE CS 2014 · Set-1 · Heap Sort & Non-Comparison Sorts

MCQ · 1 mark · Problem PROG-SORT-0037

Let P be a quick sort program to sort numbers in ascending order using the first element as the pivot. Let t1 and t2 be the number of comparisons made by P for the inputs [1 2 3 4 5] and [4 1 5 3 2] respectively. Which one of the following holds?
  1. A
    \(t_{1}=5\)
  2. B
    \(t_{1} \lt t_{2}\)
  3. C
    \(t_{1} \gt t_{2}\)
  4. D
    \(t_{1}=t_{2}\)

Solve it on GATE DA practice →More Searching & Sorting Algorithms problems

Show the worked solutionOfficial GATE Answer Key: Option C.See full step-by-step discussion on GateOverflow: https://gateoverflow.in/1780/gate2014-1-14

GATE DA practice: past exam problems by chapter, with worked solutions · gatedaprep.com