$\sqrt{n}$ vs $5^{\log_2n}$

284 Views Asked by At

I have this problem.

Given $f(n) = \sqrt{n}$ and $g(n) = 5^{\log_2n}$, which one is faster?

  1. $f(n) = \mathcal O(g(n))$
  2. $g(n) = \mathcal O(f(n))$
  3. 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!

1

There are 1 best solutions below

0
On BEST ANSWER

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$.