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

  • Context: MHB 
  • Thread starter Thread starter find_the_fun
  • Start date Start date
  • Tags Tags
    Form
Click For Summary
SUMMARY

The discussion centers on the use of big O notation with arithmetic expressions, specifically in the context of bucket sort, which has an expected time complexity of O(n+k). It clarifies that big O notation can incorporate multiple variables, such as n and k, to define the growth of a function. The relationship indicates that the upper bound is determined by the larger of the two variables once the algorithm is implemented. This understanding is crucial for accurately analyzing algorithm performance.

PREREQUISITES
  • Understanding of big O notation
  • Familiarity with algorithm time complexity
  • Basic knowledge of bucket sort algorithm
  • Concept of upper bounds in mathematical functions
NEXT STEPS
  • Research the properties of big O notation in detail
  • Study the bucket sort algorithm implementation and its performance analysis
  • Explore the implications of multiple variables in algorithm complexity
  • Learn about other sorting algorithms and their time complexities
USEFUL FOR

Computer scientists, software engineers, and students studying algorithms who seek to deepen their understanding of time complexity and big O notation.

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$
 

Similar threads

  • · Replies 15 ·
Replies
15
Views
2K
  • · Replies 3 ·
Replies
3
Views
2K
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