Proving that $h=O(\log_2 n)$ if $h=\log_2 (n+1)$

68 Views Asked by At

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.

3

There are 3 best solutions below

2
On

That's because $\log_2(n+1)\sim_\infty\log_2n$.

1
On

$\log_2(n+1) < \log_2(n^2) = 2\log_2(n)$ for sufficiently large $n$.

0
On

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