Steve M
Steve M

Reputation: 9794

What is the standard way of writing O(max(n, m))?

What is the standard way of writing "the big-O of the greatest of m and n"?

Upvotes: 3

Views: 90

Answers (1)

user2357112
user2357112

Reputation: 281683

It can be written as

O(m+n)

It might not look the same at first, but it is, since

max(m, n) <= m+n <= 2max(m, n)

If you want, you can also just write O(max(m, n))

Upvotes: 8

Related Questions