I have this problem.
Given $f(n) = \sqrt{n}$ and $g(n) = 5^{\log_2n}$, which one is faster?
- $f(n) = \mathcal O(g(n))$
- $g(n) = \mathcal O(f(n))$
- Both
I solved a couple of exercises, but the problem with this one is that I don't have any idea how to compare these two!
The trick is noticing that $5^{\log_2 x}=5^{\frac{\ln x}{\ln 2}}=e^{\frac{\ln 5}{\ln 2}\ln x}=x^{\frac{\ln 5}{\ln 2}}$. And now it's all a matter of deciding which one is the largest between $\log_25$ and $\frac12$.