Verifying reasoning: $2^{(10\log n + n/2)} = \mathcal{O}( 2^n)$

67 Views Asked by At

As the title states, why is

$$2^{(10\log n + n/2)} = \mathcal{O}( 2^n)$$

The reason given via the solutions is, where $f_2(x) = 2^n$ and $f_3(x)=2^{(10logn + n/2)}$,

If $c$ is any constant and $g(x)$ is a function, then $2^{cg(x)}$ = $(2^c)^{g(x)}$. Hence, changing the constant of the function in the exponent is the same as changing the base of the exponent, which does affect the asymptotic running time. Hence, $f_3(n)$ is $O(f_2(n))$, but $f_2(n)$ is not $O(f_3(n))$.

Is this because $f_3(x)=2^{(10\log n + n/2)} = (2^{1/2})^{20\log n + n}$ and the base of $f_3(x)$, $2^{1/2}$, is less than the base of $f_2(x)$, 2?

1

There are 1 best solutions below

2
On BEST ANSWER

Your reasoning is correct. Another way to look at this is

$$2^{(10\log n + n/2)} = (\sqrt{2})^nn^{10} = O((\sqrt{2})^n(\sqrt{2})^n) = O(2^n).$$

But it all comes down to the base in the end.

EDIT: added a step for clarification. It's pretty easy to show how if $f=O(F)$ and $g=O(G)$ that $fg = O(FG)$, so I'll leave that to you to verify.