Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Solve recurrence: T(n) = T(n^(1/2)) + Θ(lg lg n) [closed]

Started learning algorithms. I understand how to find theta-notation from a 'regular recurrence' like T(n) = Tf(n) + g(n). But I am lost with this recurrence: problem 1-2e:

T(n) = T(√n) + Θ(lg lg n)

How do I choose the method to find theta? And what, uh, this recurrence is? I just do not quite understand notation-inside-a-recurrence thing.

like image 833
Ruslan Osipov Avatar asked Jun 22 '12 01:06

Ruslan Osipov


1 Answers

This is a great place to use a variable substitution. We begin with

T(n) = T(√n) + Θ(log log n),

where the parameter n decays by a square root factor. When you see something like this, a common transform that works well is to define a new recurrence by setting S(m) = T(2m). If we do that here, we get the following:

S(m) = T(2m)

= T(√(2m)) + Θ(log log 2m)

= T(2m/2) + Θ(log m)

= S(m / 2) + Θ(log m).

In other words, we now have the recurrence

S(m) = S(m / 2) + Θ(log m).

This recurrence seems a lot easier to work with, since we no longer have that square root term shrinking things down. And in particular, this happens to be something the Master Theorem takes care of. Specifically, we have a = 1, b = 2, and d = 0. (Why do we have d = 0? Because we can think of Θ(log m) as m0 Θ(log m)). The Master Theorem then tells us that this solves to

S(m) = Θ((log m)2).

We've just solved the recurrence S(m), but we were interested in solving the recurrence T(n). How do we connect them? Well, since S(m) = T(2m), we can - assuming n is a perfect power of two - rewrite this as S(log n) = T(n). That then lets us see that

T(n) = S(log n)

= Θ((log log n)2),

which is the solution of the recurrence.

like image 135
templatetypedef Avatar answered Sep 24 '22 19:09

templatetypedef