World's most popular travel blog for travel bloggers.

# [Solved]: How to solve this recurrence using recursion tree method

, ,
Problem Detail:

How to solve this using the recursive tree method? I'm stuck with the $\max$.

$$T(n) = T\left(\left\lceil \frac{n}{\max\,\{\sqrt{n},2\}}\right\rceil\right) + n\,.$$

#### Answered By : David Richerby

Break it up into parts you can handle.

$\max\,\{\sqrt{n},2\} = \sqrt{n}$ if, and only if, $n>3$, so rewrite the recurrence as

\begin{align*} T(n) &= T(\lceil\sqrt{n}\,\rceil) + n && \text{for } n>3\\ T(n) &= T(\lceil n/2\rceil) + n &&\text{for } n\leq 3\,. \end{align*}

At that point, I think it's reasonable to solve the $n\leq 3$ part by direct substitution and then use required method for the $n>3$ case.

By the way, you also need a case for $T(1)$, since the general equation gives $T(1) = T(\lceil\tfrac12\rceil)+1 = T(1)+1$, which is impossible.