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?


1 Answer 1


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.

  • 1
    $\begingroup$ The standard way to write it is just $O(m+n)$. Units can be safely ignored. $\endgroup$ Commented Oct 15, 2012 at 15:53

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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