Which is more efficient? lg(n+10^n) higher than 2^lgn [duplicate]
-
29-09-2020 - |
Question
Based on the order by asymptotic growth rate which is more efficient?
Solution
Compute $\lim_{n\to\infty}\frac{\log(n+10^n)}{2^{\log(n)}}$. This is
$$\begin{align}\lim_{n\to\infty}\frac{\log(n+10^n)}{2^{\log(n)}}&=\lim_{n\to\infty}\frac{\log(n+1+10^{n+1})-\log(n+10^n)}{1}\\ &=\lim_{n\to\infty}\log\left(\frac{(n+1)+10^{n+1}}{n+10^n}\right)\\ &=\lim_{n\to\infty}\log\left(\frac{(n+1)/10^n+10}{n/10^n+1}\right)\\ &=\log(10)\\ &>1 \end{align}$$
where the first equation was using Stolz-Cesaro theorem (L'Hospital for sequences).
That this limit is larger than $1$ implies that for $n$ large enough $\log(n+10^n)$ becomes larger than $2^{\log(n)}$.
OTHER TIPS
Roughly speaking:
$\begin{align*} \log_2 (2^n) &= n \\ \log_2(10^n + n) &> \log_2(10^n) \\ &= n \log_2 10 \end{align*}$
As $\log_2 10 = 3.3219$, the later is larger.
For rough comparisons, you can discard "lower terms" with impunity. In any case, often "asymptotic growth rate" applies only for very large $n$, and is usually meant to hide constant factors (check e.g. Hildebrand's "Short Course on Asymptotics" for details on the notation and manipulation techniques). If so, both are $\Theta(n)$, and more details are needed to compare fairly.