Currently, I am self-studying Intro to Algorithms (CLRS) and there is one particular method they outline in the book to solve recurrence relations.
The following method can be illustrated with this example. Suppose we have the recurrence
$$T(n) = 2T(\sqrt n) + \log n$$
Initially they make the substitution m = lg(n), and then plug it back in to the recurrence and get:
$$T(2^m) = 2T(2^{\frac{m}{2}}) + m$$
Up to this point I understand perfectly. This next step is the one that's confusing to me.
They now "rename" the recurrence $S(m)$ and let $S(m) = T(2^m)$, which apparently produces
$$S(m) = 2S(m/2) + m$$
For some reason it's not clear to me why this renaming works, and it just seems like cheating. Can anyone explain this better?
"Notice that, S(m/2)=T(2^(m/2))"
That's the only part that is non-obvious to me. I'm used to the idea of making variable substitutions, but I'm not really used to the idea of substituting an entire recurrence.
– Sep 09 '12 at 21:17k
I'm getting below equation S(k) = 2S(k/2) + m How can I get substitutem
fork
– Atinesh Dec 23 '15 at 03:42m
values. Them
values in theS(m)=2S(m/2)+m.
are all the samem
.S(m)
will be translated intoT(2^m)
in the end. – xianshenglu Sep 11 '22 at 17:01