0

How can the below recurrence be solved?

$T(n) = ( \sqrt{n} + 1)T( \sqrt{n}) + 1$ and $T(2) = 1$.

I have tried the master method, but have failed!!Any help regarding this is appreciated.

John_red
  • 3
  • 2
  • Thank you so much for editing it, i was struggling to do it!! – John_red Oct 06 '16 at 01:15
  • Define "solve". Are you looking for a closed form for $T(n)$ (unlikely), or an approximation, or asymptotic behavior, or ...? – dxiv Oct 06 '16 at 01:18
  • my bad!!I am trying to find the asymptotic behavior!! – John_red Oct 06 '16 at 02:08
  • Sounds eerily familiar (Solution for a recurrence). Like in the other question, this recursion only allows you to calculate $T(n)$ for $n=2^{2^k}$. You can still derive some asymptotic behavior from that. FWIW the first iterations give $1,4,21,358$ which match A048164. – dxiv Oct 06 '16 at 03:46
  • I am still not getting it!!i have been trying since yesterday!!This thread gave me a hint, http://math.stackexchange.com/questions/239402/solve-the-recurrence-relation-tn-sqrtn-t-left-sqrt-n-right-n!!But i still couldn't do it!Thanks for the help anyway!!Will try till i find a solution!! – John_red Oct 06 '16 at 23:26
  • 1
    Please do *not* change the question to a different one, especially *after* answers have been posted which do in fact answer your original question, but no longer apply once you changed it. If you have a new/different question, just post it as a new/different question. – dxiv Oct 07 '16 at 03:44
  • Yes!!I am really sorry about that!!I wasn't gonna edit it permanently!!Me and my friend were trying to play around with the recurrence equation and i forgot to revert it back!!I am extremely sorry!!The answer you gave was perfect!! – John_red Oct 07 '16 at 04:18
  • I am really sorry about it!!This is very embarrassing!!I will never try to do it again – John_red Oct 07 '16 at 04:19
  • I'll undo my downvote once you rollback the edit to the original question. As a matter of general etiquette, it's frowned upon to change the question in ways that leave pre-existing legitimate answers or comments look silly all of a sudden. – dxiv Oct 07 '16 at 04:32
  • Yes!!I totally understand how wrong it was to do what i did!!But i assure you, it was totally unintentional!!Please do not rollback the down vote!!I am extremely sorry for what i did!! – John_red Oct 07 '16 at 04:45
  • No problem. The original question is in fact interesting on its own. The " $-$ " variation thereof is, too, but that's worth a separate question. I don't see an obvious "shortcut" for that other one. – dxiv Oct 07 '16 at 04:56
  • Yes!! "-" variation is harder than this one!!We have been trying to solve that one too!!So if we don't end up with a solution for that, we will definitely post it as a separate question!!The idea of telescoping made us change the sign from + to - and try to solve the question!! – John_red Oct 07 '16 at 05:01
  • My first guess is that $T(n)=(\sqrt{n}+a)T(\sqrt{n})+b$ would still give a $T(n) = \Theta(n)$ but that's just a random guess. – dxiv Oct 07 '16 at 05:09

2 Answers2

0

Let $F(k) = T(2^{2^k})$, so that we have $$F(k+1) = (2^{2^k}+1)F(k) + 1$$ and $F(0) = 1$. The generating function for $F$ is \begin{align} S(x) = &\ \sum_{k\ge0}F(k)x^k\\ = &\ 1 + \sum_{k\ge0}((2^{2^k}+1)F(k)+1)x^{k+1}\\ = &\ 1 + xS(x) + \frac{1}{1-x} - 1 + \sum_{k\ge1}2^{2^k}F(k)x^{k+1}\\ = &\ xS(x) + \frac{1}{1-x} + \sum_{k\ge0}2^{2^k}F(k)x^{k+1}. \end{align} Now let $C_0 = 2$ and $C_i = 2^{2^{i-1}}(2^{2^{i-1}}-1)$, so that $$2^{2^k} = \sum_{i=0}^kC_i.$$ Using this and what done above, we write \begin{align} S(x) = &\ xS(x) + \frac{1}{1-x} + \sum_{k\ge0}2^{2^k}F(k)x^{k+1}\\ = &\ xS(x) + \frac{1}{1-x} + \sum_{i\ge0}C_i\sum_{k\ge i}F(k)x^{k+1}. \end{align} I don't know how to treat the last term, so I'll leave it up to you (or any volunteers).


You could also try to apply the master theorem to $G(\ell) = T(2^\ell)$, but from the question I assume you have already tried this.

0

The recurrence can be rewritten as:

$$\frac{T(n)}{n-1} = \frac{T(\sqrt{n})}{\sqrt{n} - 1} + \frac{1}{n-1}$$

or, with:

$$n = 2^{2^k} \quad\text{and}\quad C(k)= \frac{T(2^{2^k})}{2^{2^k} - 1}$$

as:

$$C(k) = C(k-1) + \frac{1}{2^{2^k}-1}$$

and after telescoping $C(k) - C(k-1)$:

$$C(k) = C(0) + \sum_{j=1}^{k} \frac{1}{2^{2^j}-1}$$

The latter series converges (by the ratio test, for example), so the limit exists:

$$\lim_{k \to \infty} C(k) = C$$

It follows that $T(2^{2^k}) \sim C \cdot (2^{2^k} - 1)$ asymptotically, so in the end $T(n) = \Theta(n)$.

dxiv
  • 76,497
  • Hey, do you mind explaining the last line of your analysis?I am kind of stuck at the last line – John_red Oct 07 '16 at 02:25
  • Reverting to the $n$ notation, $\frac{T(n)}{n-1} = C(\log_2 \log_2 n)$ by the definition of $C(\cdot)$. But the RHS has limit $C$ at infinity, so $\frac{T(n)}{n-1} = \Theta(1)$ which implies $T(n) = \Theta(n)$. – dxiv Oct 07 '16 at 02:34