The master theorem didn't work here. I tried to do the substitution method but I ended up with an additional term: $2Σ(i \cdot 3^i)$. Also I should find the solution $g(n)$ such as $f=\Theta(g)$.
Asked
Active
Viewed 262 times
2 Answers
0
The given recurrence is: $T(n) = 3T(n/4) + \log n$
Using the substitution method, we get:
\begin{align} T(n) &= 3^2T \left(n/4^2\right) + \log n + 3\log (n/4) \\ &= 3^3T \left(n/4^3\right) + \log n + 3\log(n/4) + 9 \log(n/4^2)\\ \end{align} and so on.
Can you see a pattern now?
Gokul
- 530
- 1
- 5
- 17
0
I use a simpler master theorem for scholar recurrences. Consider the general form $T(n) = aT(n/b) + f(n)$. Call $c=log_ba$. Now you have 3 cases:
- $\theta(n^c) = f(n)$ then $T(n) = \theta(f(n)log^k(n)) \text{ where }k\geq1$
- $\theta(n^c) \gt f(n)$ then $T(n) = \theta(n^c)$
- $\theta(n^c) \lt f(n)$ then $T(n) = \theta(f(n))$
In your exercise you have the 2nd case, so $T(n) = \theta(n^{log_43})$.
However this method works only with simple recurrences.
Emanuele
- 58
- 7