5

How do I solve the recurrence

$$T(n) = T(n-2) + \log(n)$$

with the condition that $T(n) = O(1)$ for $n \leq 2$?

I started by using an iterative method

$$T(n-2) = T(n - 4) + \log(n-2)$$

then substituting this into the first equation, we find

$$T(n) = T(n - 4) + \log(n-2) + \log(n)$$

Inductively, the next iteration would be

$$T(n) = T(n - 6) + \log(n - 4) + \log(n - 2) + \log(n)$$

and so I saw following pattern

$$T(n) = T(n - 2k) + \sum_{i = 0}^{k - 2} \log(n - 2i)$$

Is this pattern correct, and if so, how should I precede with next step? I am not sure how to transform this sum.

Matthew Cassell
  • 4,248
  • 4
  • 21
  • 30
  • Think about what happens when $2k=n$. That will then give you a explicit formula for $T(n)$. – Stone Nov 20 '17 at 12:07
  • 1
    It's easier to solve if one uses $,U(n):=e^{T(2n)},$ and $,V(n):=e^{T(2n+1)},$ . – user90369 Nov 20 '17 at 12:19
  • Similar to @user90369's comment, can you recall what $\log(a) + \log(b)$ is? Perhaps it has a nicer form? (think about the definition of $\log$) – mdave16 Nov 20 '17 at 13:59

0 Answers0