UGC-NET Sep 2013 · Asymptotic Analysis & Recurrences

MCQ · 2 marks · Problem PROG-DIVC-0010

The time complexity of reccurence relation T(n) = T(n/3) + T(2n/3) +O(n) is
  1. A
    O(Ig n)
  2. B
    O(n)
  3. C
    O(n Ig n)
  4. D
    O(n$^2$)

Solve it on GATE DA practice →More Searching & Sorting Algorithms problems

Show the worked solutionUse the recursion tree for \(T(n)=T(n/3)+T(2n/3)+cn\). Each level splits the problem into parts of total size \(n\), so every full level costs \(cn\). The longest path follows the \(2n/3\) branch, giving depth \(\log_{3/2}n\); the shortest has depth \(\log_3 n\).\[cn\log_3 n\le T(n)\le cn\log_{3/2}n\ \Rightarrow\ T(n)=\Theta(n\lg n).\]Answer: C

GATE DA practice: past exam problems by chapter, with worked solutions · gatedaprep.com