GATE CS 2014, set 1 · Question 24 · Algorithms · Multiple choice (MCQ) · 1 mark · −1/3 for a wrong answer

Let P be a quicksort program to sort numbers in ascending order using the first element as the pivot. Let t₁ and t₂ 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₁ = 5
  2. (B) t₁ < t₂
  3. (C) t₁ > t₂
  4. (D) t₁ = t₂
Answer

Answer (C)

Answer from the official GATE CS 2014 answer key.

The step-by-step solution, where available, is part of GATE CS Pro. See what Pro includes