GATE CS 1987 · Heap Sort & Non-Comparison Sorts

MCQ · 1 mark · Problem PROG-SORT-0065

Let P be a quicksort program to sort numbers in ascending order. Let \(t_{1}\) and \(t_{2}\) be the time taken by the program for the inputs \(\left[1 \ 2 \ 3 \ 4\right]\) and \(\left[5 \ 4 \ 3 \ 2 \ 1\right]\), respectively. Which of the following holds?
  1. A
    \(t_{1} = t_{2}\)
  2. B
    \(t_{1} \gt t_{2}\)
  3. C
    \(t_{1} \lt t_{2}\)
  4. D
    \(t_{1}=t_{2}+5 \log 5\)

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/80366/gate1987-1-xviii

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