Let \(P\) be quicksort program to sort numbers in ascending order using the…

PYQ GATE 2014

Let PP be quicksort program to sort numbers in ascending order using the first element as the pivot. Let t1t_1 and t2t_2 be the number of comparisons made by PP for the inputs  [1 2 3 4 5] and [4 1 5 3 2] respectively. Which one of the following holds?

  1. A.

    t1=5t_1 = 5

  2. B.

    t1<t2t_1 < t_2

  3. C.

    t1>t2t_1 > t_2

  4. D.

    t1=t2t_1 = t_2

Attempted by 560 students.

Sign up free to check your answer

Sign up free

Explore the full course: Algorithms

Loading lesson…