Explaining the Upper-bound for Big-O (e.g. O(n))?

72 Views Asked by At

Given the following real function: $ f(n) = n+1 $, where $f(n) \subseteq O(n)$, I don't understand how this can show that $O(n)$ is an upper-bound for $f(n)$. Especially when you graph it; $f(n)$ shows up above $O(n)$.

Is there any other example of a function that is part of $O(n)$ that can demonstrate how the Big-O works as an upper-bound?

Thank you.

1

There are 1 best solutions below

4
On BEST ANSWER

A function being $\mathcal{O}(n)$ implies that there exists a positive constant $c > 0$, so that for "large" $n$ (i.e. $n \geq n_0$ for some $n_0 \in \mathbb{N}$), it holds that

$$ f(n) \leq c n $$

In your case, notice that $n + 1 \leq 2 n \Rightarrow f(n) \leq 2n, \forall n \geq 1$.