-2

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?

Raphael
  • 73,212
  • 30
  • 182
  • 400
Computernerd
  • 639
  • 2
  • 11
  • 17

1 Answers1

3

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)$.

Yuval Filmus
  • 280,205
  • 27
  • 317
  • 514