Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Which of the growth rates log(log *n) and log*(log n) is faster?

As n gets large, of the two functions log*(log n) and log(log* n) will will be faster?

Here, the log* function is the iterated logarithm, defined here:

enter image description here

I suspect these are the same, just written differently, but is there any difference between them?

like image 282
user97452 Avatar asked Oct 04 '13 03:10

user97452


People also ask

Which grows faster log n or n?

Clearly log(n) is smaller than n hence algorithm of complexity O(log(n)) is better. Since it will be much faster.

Is log log n faster than n?

O(log log n) is better time complexity O(log n) because log log n is smaller than log n.

Which function has highest growth rate?

Exponential functions grow very quickly, so exponential algorithms are only useful for small problems.

Does log n 2 grow faster than log n?

No. logn≈logn2 within a constant factor, that is, the growth rate is the same! logn is related to n in exactly the same way that n is related to 2n.


1 Answers

log* n is the iterated logarithm, which for large n is defined as

log* n = 1 + log*(log n)

Therefore, log*(log n) = (log* n) - 1, since log* is the number of times you need to apply log to the value before it reaches some fixed constant (usually 1). Doing another log first just removes one step from the process.

Therefore, log(log* n) will be much smaller than log* (log n) = log* n - 1 since log x < x - 1 for any reasonably large x.

Another, more intuitive way to see this: the log* function is significantly better at compressing large numbers than the log function is. Therefore, if you wanted to take a large number and make it smaller, you'd get way more efficiency by computing log* n first to contract n as much as you can, then use log on that (log (log* n)) to pull down what's left.

Hope this helps!

like image 154
templatetypedef Avatar answered Nov 15 '22 08:11

templatetypedef