According to the book "Introduction to Algorithms" a function that has the following form
$f(n)=an+b$
belong to $O(n^2)$ , and that this can be easily proven if we set
$c = a +|b|$
But I don't get it, it still seems to belong to $O(n)$.
2026-04-04 09:41:49.1775295709
Big O notation $a*n + b = O(n^2)$
637 Views Asked by Bumbble Comm https://math.techqa.club/user/bumbble-comm/detail At
2
Everything in $O(n)$ is also $O(n^2)$. Recall that a function f(n) is O(n) if $f(n) \leq cn$ for sufficiently large $n$ and some constant $c>0$. Well, if $f(n) \leq cn$, then it's also the case that $f(n) \leq c n^2$ for all appropriately large $n$, so f(n) is $O(n^2)$ as well.