GATE | GATE CS Mock 2018 | Set 2 | Question 56
The worst-case running time of Merge sort algorithm is described by the following recurrence relation :
⌈ 1 , if n = 1
T(n) = | 2T(n/2)+ n , otherwise
⌊
Given recurrence equation evaluates to –
(A) 2k T(n/2k) + kn
(B) 2k T(nk/2) + kn
(C) nk T(n/2k)
(D) T(n/2k) + kn
Answer: (A)
Explanation:
T(n) = 2T (n/2) + n
= 21 T(n/21) + 1.n [ k = 1]
= 2k-1 T(n/2k-1) + (k-1)n
= 2k-1 (2T(n/2k + n/2k-1) + (k-1)n
= 2k T(n/2k) + kn
Option (A) is Correct.
Quiz of this Question
Last Updated :
08 Mar, 2018
Like Article
Save Article
Share your thoughts in the comments
Please Login to comment...