Suppose that $h=\log_2 (n+1)$. Why is $h$ also $O(\log_2 n)$?
I know the definition of big $O$ notation, and properties or logarithms, but I can't figure it out - that $+1$ is causing troubles.
Suppose that $h=\log_2 (n+1)$. Why is $h$ also $O(\log_2 n)$?
I know the definition of big $O$ notation, and properties or logarithms, but I can't figure it out - that $+1$ is causing troubles.
$\log_2(n+1) < \log_2(n^2) = 2\log_2(n)$ for sufficiently large $n$.
That's because $\log_2(n+1)\sim_\infty\log_2n$.
$$\log (n+1) = \log (n(1+\frac 1 n))= \log n + \log \left(1+\frac 1 n\right)$$
Then $\frac {\log (n+1)}{\log n }=\frac {\log n +\log \left( 1 + \frac 1 n\right)}{\log n}\to1$.