1

One example in my textbook says that

$$\log\log n^n=\log n\log n=\log n+\log\log n = \mathcal{O}(\max(\log n, \log\log n))=\mathcal{O}(\log\log n)$$

and I was wondering why is that true? I thought that

$$\log n \leq n \Leftrightarrow \log\log n \leq \log n.$$

So, for $C=1$ and $n\geq 1$ we have $\log\log n =\mathcal{O}(\log n)$.

Thanks for any advice.

Raphael
  • 72,336
  • 29
  • 179
  • 389
gkos
  • 11
  • 1
  • 6
    That does seem to be a mistake, have you looked for errata for your textbook? (The publisher usually makes them available online these days) – Luke Mathieson Sep 01 '16 at 04:20
  • 3
    Also, anybody who writes $\log n\log n$ to mean $\log(n\log n)$ deserves to have their textbook discarded. – David Richerby Sep 01 '16 at 08:03
  • Since this question already contains a complete answer, there's not really anything else to say, so I'm voting to close this as a duplicate of... oh, Raphael already did it while I was looking for a link to that question. – David Richerby Sep 01 '16 at 08:06
  • Note that $f \in O(g)$ and $g \in O(f)$ are not mutually exclusive statements. 2) $\log n \in \omega(\log \log n)$ so there is definitely a mistake. See our reference question for how to prove that. 3) Note that this is a purely mathematical issue, completely independent of algorithms or complexity.
  • – Raphael Sep 01 '16 at 08:06
  • 2
    @DavidRicherby Stand back, the omega police has arrived. ;D – Raphael Sep 01 '16 at 08:06
  • Thanks for info guys, sorry if it was duplicate or math related only, it was my first question in stackex. ;) – gkos Sep 02 '16 at 02:03