Tell me more ×
Computational Science Stack Exchange is a question and answer site for scientists using computers to solve scientific problems. It's 100% free, no registration required.

I have written an algorithm where the 2 input arguments are a file and a list of values. I would like to say the algorithm complexity is:

O(max{n,m}) where n is the size of the file and m is the length of the list

But maybe I'm mixing apples and oranges here. What is the correct way to write or express this?

share|improve this question

1 Answer

up vote 4 down vote accepted

Writing $O(m)+O(n)$ avoids the problem of having to address units. Note that $\max(m,n)$ and $m+n$ have the same order, and having max in a Landau symbol is quite uncommon.

share|improve this answer
1  
The standard way to write it is just $O(m+n)$. Units can be safely ignored. – Geoffrey Irving Oct 15 '12 at 15:53

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.