Reputation: 193
If I have two variables,say m and n,and my algorithm has time complexity O(m+n),is O(m,n) the same as having O(max(m,n))?If yes,can you explain why?
Upvotes: 0
Views: 445
Reputation: 6338
Yes. Because O(m+n) is always smaller than O(2(m+n)), which only differs by a constant factor from O(m+n), and max(m+n) < 2(m+n). That's just one way to analyze it.
Upvotes: 2