What is the Big O class of the following expression:

$$2^{\log \log n}$$

I think the Big O is $2^n$ as I assume $\log \log n$ to be $n$. Is my assumption correct?

  • 2
    $\begingroup$ Do you know what $\log$ means? $\endgroup$ – Amit Kumar Gupta Jul 18 '14 at 5:31
  • $\begingroup$ What have you tried towards proving your hypothesis? Also, there is no such thing as "the big O". Finally, this question requires high-school mathematics to answer (specifically, calculation laws of powers) and not computer science expertise. $\endgroup$ – Raphael Jul 18 '14 at 7:29
  • $\begingroup$ Do you know what an equation is? Using the right words and the right concepts is the beginning of understanding. $\endgroup$ – babou Jul 18 '14 at 7:50
  • 2
    $\begingroup$ @babou You edited the question and that automatically nominates it for reopening. $\endgroup$ – David Richerby Jul 18 '14 at 9:46
  • 1
    $\begingroup$ @DavidRicherby Thanks David. I did not know. Furthermore, I was not aware it was put on hold while I was editing. This question is interesting only as a nice compendium of a variety of errors, both in substance and in style. $\endgroup$ – babou Jul 18 '14 at 9:57

The big O (or rather, a big O) of $2^{\lg\lg n}$ is $O(2^{\lg\lg n})$. It is also $O(\log n)$, assuming $\lg$ is logarithm to base 2. Both expressions are tight, in the sense that in fact $2^{\lg\lg n} = \Theta(2^{\lg\lg n}) = \Theta(\log n)$.

The morale is that any expression can function as big O. We are usually aiming at a simple expressions, which is why we use $O(n^3)$ for $2n^3 + 15n\log$, for example. There are some canonical big O expressions, such as $O(n^a\log^b n)$. That means that if your function $f$ has order of growth $\Theta(n^a\log^b n)$, then you would usually describe it this way. Under this convention, a (tight) big O of $2^{\lg\lg n}$ is $O(\log n)$.

| cite | improve this answer | |
  • 2
    $\begingroup$ I strongly recommend not writing "The big O", even though the phrase is taken from the question. The definite article implies uniqueness and the whole point of your answer is that it isn't unique. Normally, using little phrases from the question is good writing style but, in this case, I think it confuses the issue. (And this comment is only about writing style - I know you understand the mathematics.) $\endgroup$ – David Richerby Jul 18 '14 at 9:50
  • $\begingroup$ "assuming lg is logarithm to base 2" -- isn't it the same for any base? Exchanges of bases only yield constant factors. $\endgroup$ – Raphael Jul 18 '14 at 16:09
  • $\begingroup$ @Raphael Not in the exponent. $\endgroup$ – Yuval Filmus Jul 18 '14 at 16:19

Not the answer you're looking for? Browse other questions tagged or ask your own question.