Does anyone know how to solve the below? I'm guessing that I need to use the Subtraction method or iteration but still I'm having a hard time with it.
$$T(n)=3T(n-1)+3^n\times n^2$$
Does anyone know how to solve the below? I'm guessing that I need to use the Subtraction method or iteration but still I'm having a hard time with it.
$$T(n)=3T(n-1)+3^n\times n^2$$
Exapnd the equation:
$$T(n) = 3(3T(n-2) + 3^{n-1}\times(n-1)^2) + 3^n\times n^2=$$ $$3^2T(n-2) + 3^n(n^2 + (n-1)^2)= \cdots = $$ $$3^n\sum_{i=1}^{n}i^2 = 3^n \times \frac{n(n+1)(2n+1)}{6} = \Theta(3^n\times n^3) $$