$f(n) = O(g(n))$ then $(f(n)+1)=O(g(n))$

40 Views Asked by At

How can I prove this? I thought that I can go with the definition of the O notation. But I wonder if there is a trick about this question. Is it different from $f(n)=O(g(n))$?

1

There are 1 best solutions below

0
On BEST ANSWER

Let $f\in O(g(n))$. Then there exists a positive integer $n_0$ and a positive constant $C>0$ such that $f(n)\leqslant Cg(n)$ for $n\geqslant n_0$. We may assume without loss of generality that there exists $n_1$ such that $f(n)\geqslant 1$ for $n\geqslant n_1$. Set $N=\max\{n_0,n_1\}$, then for $n\geqslant N$ we have $$ f(n)+1 \leqslant 2f(n) \leqslant 2Cg(n), $$ so that $f(n)+1\in O(g(n))$.