Big-O complexity of multiple variables with different functions

1.1k Views Asked by At

I am trying to figure out what is the total Big-O complexity of a problem with multiple variables and different mathematical functions.

The two big steps in the problem takes O(n*m) and O(n*logn). Both n and m are independent and can be very big or very small.

What is the correct complexity? Is it O(n*m)? O(n*logn)? Or O(n*m+n*logn)?

1

There are 1 best solutions below

4
On BEST ANSWER

Assuming the two big steps happen one after the other (not in parallel), the best we can say is that it takes $O(nm + n\log(n))$ time to complete. If you knew more information of how $n$ and $m$ relate to eachother then you could simplify more.