Question

Prove max(O(f(n)), O(g(n)))=O(max(f(n), g(n))

It does make sense, but so far I don't have any idea how to actually prove it.

Any input would be appreciated.

Was it helpful?

Solution

f(n) <= max(f(n), g(n))
g(n) <= max(f(n), g(n))

max(O(f(n)), O(g(n))) <= O(max(f(n), g(n)), max(f(n), g(n))) = O(max(f(n), g(n)))

Note that the in-equalities used are not strict.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top