How would you prove/disprove that $e^n = O(2n^2)$? It's unclear to me which function grows faster.
Asked
Active
Viewed 170 times
2 Answers
4
Try plotting them. You can also notice that as $n$ increases by one, $e^n$ increases by a multiplicative factor of $e^{n+1}/e^n=e$, while $2n^2$ increases by a multiplicative factor of $\frac{2(n+1)^2}{2n^2} \longrightarrow 1$.
Yuval Filmus
- 280,205
- 27
- 317
- 514
2
You can avoid $O(2n^2)$ by $O(n^2)$. On the other hand, you have:
$$ \lim_{n\to\infty} \frac{n^2}{e^n} = \lim_{n\to\infty} \frac{2n}{e^n} = \lim_{n\to\infty} \frac{2}{e^n} = 0 $$ So, $\lim_{n\to\infty} \frac{n^2}{e^n} = 0$ say us that $O(n^2) \subset O(e^n)$. Therefore, $O(2n^2) = O(n^2) \subset O(e^n)$.
Jonathan Prieto-Cubides
- 2,229
- 3
- 18
- 26