Why or why not? It seems like the answer should be no, but on the other hand, it's weird that you'd reach the same value in a constant multiple of n.
Asked
Active
Viewed 577 times
3
-
3One may observe that, as $n \to \infty$, $\displaystyle \frac{2^n}{2^{n/2}} \to \infty.$ – Olivier Oloa Nov 18 '18 at 00:45
-
3a constant multiple of $n$ has big consequences when $n$ is in the exponent – mathworker21 Nov 18 '18 at 00:48
3 Answers
1
By exponent rules, $O(2^{n/2}) = O((2^{1/2})^n) \approx O(1.414^n)$ which clearly differs from $O(2^n)$ by more than a constant factor (consider the ratio).
qwr
- 10,716
0
I made the same mistake once but if you write $x=2^n$, then you would have $O(x) = O(x^2)$ which of course doesn't make sense.
Stan Tendijck
- 2,422
-
This answer doesn't work in general -- what if $x=2$? Then $O(x) = O(x^2) = O(e^x)$, which makes perfect sense (in this context, abusing notation in the way you do it by not viewing $x$ as a variable). – Carl-Fredrik Nyberg Brodda Oct 04 '22 at 17:47