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

  • Thread starter Thread starter find_the_fun
  • Start date Start date
  • Tags Tags
    Form
Click For Summary
The discussion centers on the use of big O notation in relation to bucket sort's expected time complexity of O(n+k). It explores the rationale behind incorporating arithmetic in big O notation, emphasizing that it reflects the combined growth rates of two variables, n and k. The notation indicates that the upper bound is not determined until the algorithm is implemented, allowing for either n or k to dominate the complexity. The conversation also touches on a fundamental property of big O notation, stating that if two functions are in O of their respective bounds, their sum is also in O of the sum of those bounds. This highlights the flexibility of big O notation in analyzing algorithmic performance based on varying inputs.
find_the_fun
Messages
147
Reaction score
0
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)?
 
Technology news on Phys.org
find_the_fun said:
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
 
find_the_fun said:
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$
 
Learn If you want to write code for Python Machine learning, AI Statistics/data analysis Scientific research Web application servers Some microcontrollers JavaScript/Node JS/TypeScript Web sites Web application servers C# Games (Unity) Consumer applications (Windows) Business applications C++ Games (Unreal Engine) Operating systems, device drivers Microcontrollers/embedded systems Consumer applications (Linux) Some more tips: Do not learn C++ (or any other dialect of C) as a...

Similar threads

  • · Replies 15 ·
Replies
15
Views
2K
  • · Replies 3 ·
Replies
3
Views
1K
Replies
6
Views
5K
  • · Replies 10 ·
Replies
10
Views
2K
Replies
2
Views
3K
Replies
8
Views
2K
  • · Replies 3 ·
Replies
3
Views
2K
  • · Replies 6 ·
Replies
6
Views
6K
Replies
15
Views
16K
Replies
8
Views
2K