I need help with a home task with computer science. the problem is: compare the two complexity functions: $F(n) = n^{10\log n}$ and $G(n) = (\log n)^n$. Which is $O(\ )$ of the other? Which is $\Omega(\ )$ of the other?
3 Answers
$F(n) = n^{10\log{n}}$ and $G(n) = (\log{n})^n$
The crux of the solution is to take $\log$ on both sides of both functions to get $$F'(n) = \log{F(n)} = 10\log^2{n}$$ $$G'(n) = \log{G(n)} = n\log\log{n}$$ $$\exists c,N \, s.t. \ \log^2n \le c*n\log\log n \ \ \forall n > N$$
I'll leave the proof of the above statement to you as an exercise. Thus we can now conclude that
$$\implies F'(n) = \mathcal{O}(G'(n))$$ $$\implies e^{F'(n)} = \mathcal{O}(e^{G'(n)}) $$ $$\implies F(n) = \mathcal{O}(G(n))$$
This is due to the fact that $\log(x)$ is a monotonically increasing function. This should be sufficient for you to proceed further for $\Omega$.
- 1,208
- 9
- 20
[Note: this probably should be a comment, but it's too long and I don't like comments that need to be split over multiple entries.]
You need to be a bit careful with these arguments, since it's not always the case that $$\log f(n)\in O(\log g(n))\Longrightarrow f(n)\in O(g(n))$$ Consider, for example, $f(n)=3^n, g(n)=2^n$. We obviously have $\log 3^n\in O(\log 2^n)$, since $n\log3\in O(n\log 2)$, but we can't conclude from that that $3^n\in O(2^n)$.
See here for a further discussion. By the way, in this particular case, Banach Tarski's answer was correct.
- 15,016
- 5
- 43
- 54
You can also solve this problem by rewriting $n^{10 \log(n)} = e^{10 \log^2(n)}$.
Now, in $(\log(n))^n$, both the base and the exponent grow asymptotically faster.
This is not completely rigorous, but can at least help to give the idea for which function is the $O$ of which function.
- 355
- 3
- 15