Last Updated : 21 Dec, 2018

Match the following recurrence relation in List-I to their running time complexity in List-II:

List-I List-II
(a) T(4n/5) + Θ(n) (i) Θ(n2logn)
(b) 16·T(n/4) +n22log3n (ii) Θ(√nlogn)
(c) 4T(n/2) + Θ(n2) (iii) Θ(n2log4n)
(d) 2·T(n/4) +√n (iv) Θ(n)

(A) (a) – (iii), (b) – (ii), (c) – (iv), (d) – (i)
(B) (a) – (iv), (b) – (iii), (c) – (i), (d) – (ii)
(C) (a) – (ii), (b) – (iii), (c) – (i), (d) – (iv)
(D) (a) – (i), (b) – (ii), (c) – (iv), (d) – (iii)


Answer: (B)

Explanation: According to Master theorem in a recurrence relation:

  1. T(4n/5) + Θ(n) = Θ(n)
  2. 16·T(n/4) +n22log3n
    Using Master Theorem, we compare n2log3n withnlog416 = n2. This is another generalized version of the theorem, so we increment the logkn for Θ(n2log4n).

  3. 4T(n/2) + Θ(n2) = Θ(n2logn)
  4. 2·T(n/4) +√n
    Using the master theorem, a = 2, b = 4, and logba = log42 = 1/2. Thus, we compare nlogba = n1/2 to f(n) = √n. Since these are asymptotically equivalent. This means that we gain an additional logn factor and T(n) = Θ(√nlogn).
  5. So, option (B) is correct.


    Quiz of this Question


    Share your thoughts in the comments