1
$\begingroup$

How in God's name could I find a closed form of $T(n)=T(\lceil n/2 \rceil)+T(\lfloor n/2 \rfloor)+2$?

I'm looking at the first numbers in sequence and I just don't see any relation...

$\endgroup$
4
$\begingroup$

$$\begin{align} T(2) &= 2T(1)+2\\ T(3) &= T(2) + T(1) + 2 = 3T(1)+4\\ T(4) &= 2T(2) + 2 = 4T(1)+6\\ T(5) &= T(3) + T(2) + 2 = 5T(1) + 8\\ T(6) &= 2T(3) + 2 = 6T(1) + 10\\ T(7) &= T(4) + T(3) + 2 = 7T(1) + 12 \end{align}$$

I see a pattern.

| cite | improve this answer | |
$\endgroup$
  • $\begingroup$ Great! no God's name invoking in your answer. $\endgroup$ – Matemáticos Chibchas Mar 25 '14 at 20:37
1
$\begingroup$

The answer is $T(n)=nT(1)+2(n-1)$.

| cite | improve this answer | |
$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.