GATE | GATE CS 1996 | Question 40

Last Updated :
Discuss
Comments

Quicksort is run on two inputs shown below to sort in ascending order taking the first element as pivot,

(i) 1, 2, 3,......., n
(ii) n, n-1, n-2,......, 2, 1 

Let C1 and C2 be the number of comparisons made for the inputs (i) and (ii) respectively. Then,

C1 < C2 
 

C1 > C2

C1 = C2

We cannot say anything for arbitrary n

Share your thoughts in the comments