2

So, this is how I solved

$\displaystyle T(n-1) \approx{} T(n-2) $

$\displaystyle T(n) = T(n-1)^2 $

Add log in both sides

$\displaystyle log(T(n)) = 2log(T(n-1)) $

$\displaystyle Let\:\: log(T(n)) = S(n) $

$\displaystyle S(n) = 2(S(n-1)) $

We know that from Fibonacci series

$\displaystyle S(n) = O(2^n) $

$\displaystyle log(T(n)) = O(2^n) $

$\displaystyle (T(n)) = O(2^{2^n}) $

Ok, so where did I go wrong here??

Raphael
  • 72,336
  • 29
  • 179
  • 389
Arjun Hegde
  • 159
  • 6
  • 1
  • You seem to be after solving a recurrence for function $T$, not analysing a recursive algorithm called T. 2) You're using $=$, $\approx$, and $= O$ a little willy nilly. Try deriving sandwich recurrences, i.e. $T_l(n) \leq T(n) \leq T_u(n)$, given by recurrences you can solve. If $T_l \in \Theta(T_u)$, you've won.
  • – Raphael Feb 20 '19 at 20:21
  • 1
    Be very careful using this "log on both sides" thing. It does not always work! See our reference questions here and here for related reading. – Raphael Feb 20 '19 at 20:23
  • 2
    Taking logarithm on both sides immediately would have been so simple and led directly to the result. – gnasher729 Feb 20 '19 at 20:58