GATE / CS ARCHIVE

GATE CSE 2014 SET 2 / QUESTION 13

GATE CSE 2014 Set 2 Q13

Algorithms · Asymptotic Analysis & Recurrences · Full GATE CSE 2014 Set 2 paper

GATE 2014 Set 2, Q13 1 mark · MCQ
Report issue

Asymptotic Analysis & Recurrences

Question 13, GATE 2014: Solve asymptotically T(n)=2T(n/2)+log n with T(1)=1. A Θ(n); B Θ(n log n); C Θ(n²); D Θ(log n).
Tap to enlarge
Your answer
Answer & solution

Official answer: A

1. Set up the reasoning. Apply the Master theorem with a=2 and b=2: nlogb a=n. The extra work log n grows polynomially more slowly than n, for example log n=O(n1/2).

2. Derive the result. For T(n)=2T(n/2)+log n, the leaf contribution is n. At level i, extra cost is 2i(log₂n−i); its total over levels is O(n). Equivalently log n is polynomially smaller than n in the Master theorem. Therefore T(n)=Θ(n), A.

3. Check the interpretation. There are n constant-cost leaves, which already force an Ω(n) lower bound. The logarithmic work is not multiplied by n at every level; subproblem sizes shrink, and summing the level costs gives O(n).

Original paper, page 32 · Answer key