2

Show by induction that any solution to a recurrence of the form $ T(n) \le 2T(n/3) + c\log_3 n $ is $O(n\log_3 n)$.

Hoping someone can help me with the correct solution. I attempted two ways to get the solution (but I think that they're both incorrect):

SOLUTION A

\begin{align} T(n) &\le 2T(n/3) + c \log_3 n \\ &\leq 2[k(n/3)\log_3(n/3)] + c\log_3 n \\ &= (2/3)kn(\log_3 n-1) + c\log_3 n \\ &= (2/3)(kn)\log_3 n \\ &= (2/3)kn + c\log_3n \\ &= [(2/3)kn + c]\log_3n - (2/3)kn \end{align}

SOLUTION B

\begin{align} T(n) &\le 2T(n/3) + c \log_3n \\ &\le 2 [ k(n/3)\log_3(n/3) ] + c \log_3n \\ &= (kn - kn/3)(\log_3n - 1) + c \log_3n \\ &= (kn)\log_3n - (kn/3)\log_3n - kn + c\log_3n \\ &= (kn)\log_3n - (2/3)kn + (c - kn/3)\log_3n \end{align}

Yuval Filmus
  • 280,205
  • 27
  • 317
  • 514
swabygw
  • 121
  • 2

1 Answers1

1

Here is what happens when you use the substitution method, assuming a base case of $T(1) = 0$ and $c=1$: \begin{align} T(3^m) &\leq m + 2T(3^{m-1}) \\ &\leq m + 2(m-1) + 2^2T(3^{m-2}) \\ &\leq m + 2(m-1) + 2^2(m-2) + 2^3T(3^{m-3}) \\ &\leq \ldots \\ &\leq m + 2(m-1) + 2^2(m-2) + \cdots + 2^{m-1}(1) + 2^m T(1) \\ &= m + 2(m-1) + 2^2(m-2) + \cdots + 2^{m-1}(1) \\ &= m(1 + 2 + \cdots + 2^{m-1}) - (2 + 2^2 + \cdots + 2^{m-1}) - (2^2 + \cdots + 2^{m-1}) - \cdots - (2^{m-1}) \\ &= m(2^m-1) - (2^m-2) - (2^m-2^2) - \cdots - (2^m-2^{m-1}) \\ &= m(2^m-1) - (m-1)2^m + (2 + 2^2 + \cdots + 2^{m-1}) \\ &= m(2^m-1) - (m-1)2^m + (2^m-2) \\ &= 2^{m+1}-m-2. \end{align} This shows that $T(n) = O(n^{\log_32})$.

Yuval Filmus
  • 280,205
  • 27
  • 317
  • 514