GATE | GATE-CS-2015 (Set 1) | Question 12
Which one of the following is the recurrence equation for the worst case time complexity of the Quicksort algorithm for sorting n(≥ 2) numbers? In the recurrence equations given in the options below, c is a constant.
(A) T(n) = 2T (n/2) + cn
(B) T(n) = T(n – 1) + T(0) + cn
(C) T(n) = 2T (n – 2) + cn
(D) T(n) = T(n/2) + cn
Answer: (B)
Explanation: In worst case, the chosen pivot is always placed at a corner position and recursive call is made for following.
a) for subarray on left of pivot which is of size n-1 in worst case.
b) for subarray on right of pivot which is of size 0 in worst case.
Quiz of this Question
Recommended Posts:
- GATE | GATE-CS-2015 (Mock Test) | Question 17
- GATE | GATE-CS-2015 (Mock Test) | Question 16
- GATE | GATE-CS-2015 (Mock Test) | Question 17
- GATE | GATE-CS-2015 (Mock Test) | Question 14
- GATE | GATE-CS-2015 (Mock Test) | Question 13
- GATE | GATE-CS-2015 (Mock Test) | Question 17
- GATE | GATE-CS-2015 (Mock Test) | Question 11
- GATE | GATE-CS-2015 (Mock Test) | Question 10
- GATE | GATE-CS-2015 (Mock Test) | Question 9
- GATE | GATE-CS-2015 (Mock Test) | Question 8
- GATE | GATE-CS-2015 (Mock Test) | Question 10
- GATE | GATE-CS-2015 (Mock Test) | Question 10
- GATE | GATE-CS-2015 (Mock Test) | Question 5
- GATE | GATE-CS-2015 (Mock Test) | Question 4
- GATE | GATE-CS-2015 (Mock Test) | Question 17



