UGC-NET Dec 2015 · Asymptotic Analysis & Recurrences

MCQ · 2 marks · Problem PROG-DIVC-0048

For the recurrence relation\[T(n)\le\begin{cases}\Theta(1) & \text{if } n\le 80\\ T\left(\dfrac{n}{5}\right)+T\left(\dfrac{7n}{10}+6\right)+O(n) & \text{if } n>80\end{cases}\]the tightest upper bound on \(T(n)\) is
  1. A
    $O(\lg n)$
  2. B
    $O(n)$
  3. C
    $O(n \lg n)$
  4. D
    None of the above

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

Show the worked solution\[\boxed{\frac{n}{5}+\frac{7n}{10}=\frac{9n}{10}<n}\]The two subproblems together are a constant fraction smaller than \(n\), so the linear work dominates. Substitution: assume \(T(m)\le cm\) for \(m<n\) and let the \(O(n)\) term be at most \(an\). Then\[T(n)\le \frac{cn}{5}+c\left(\frac{7n}{10}+6\right)+an=cn-\left(c\left(\frac{n}{10}-6\right)-an\right).\]For \(n>80\), \(\dfrac{n}{10}-6>\dfrac{n}{40}\), so any \(c\ge 40a\) gives \(T(n)\le cn\). Hence \(T(n)=O(n)\); this is the recurrence of the median-of-medians selection algorithm.\(O(n\lg n)\) is also an upper bound, but not the tightest. The official UGC NET key was C.Answer: B

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