# How can big O's have values of the form A+B?

#### find_the_fun

##### Active member
For example according to wikipedia and this question bucket sort has the expected time complexity O(n+k). How does it make sense to use big O notation with arithmetic in it? Is it because it is not known which of n or k will determine the upper bound but once it is known (i.e. the algorithm is implemented) then it would be known if it actually is O(n) or O(k)?

#### CaptainBlack

##### Well-known member
For example according to wikipedia and this question bucket sort has the expected time complexity O(n+k). How does it make sense to use big O notation with arithmetic in it? Is it because it is not known which of n or k will determine the upper bound but once it is known (i.e. the algorithm is implemented) then it would be known if it actually is O(n) or O(k)?
To say that $$f(n,k)\in O(n+k)$$ means that there exists a $$C>0$$ such that for $$n+k$$ large enough:

$|f(n,k)| < C |n+k|$

That is they jointly define the bound on the growth of $$|f(x,k)|$$

CB

#### chisigma

##### Well-known member
For example according to wikipedia and this question bucket sort has the expected time complexity O(n+k). How does it make sense to use big O notation with arithmetic in it? Is it because it is not known which of n or k will determine the upper bound but once it is known (i.e. the algorithm is implemented) then it would be known if it actually is O(n) or O(k)?
One of the basic property of the 'big-O notation' is that, if f and g are positive functions, then ...

$\displaystyle f_{1} \in \mathcal{O} (g_{1})\ \text{&}\ f_{2} \in \mathcal{O} (g_{2}) \implies f_{1}+f_{2} \in \mathcal{O} (g_{1}+g_{2})$

Kind regards

$\chi$ $\sigma$