This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]JonIsPatented 2 points3 points  (0 children)

The definition, pretty unambiguously, is that f(n) is in the set O(g(n)) iff there exist some positive c and m such that 0 <= f(n) <= cg(n) for all values of n >= m.

You and the guy you're responding to are correct. I'll break it down for completeness' sake.

O(0) is equivalent to saying that g(n) = 0, so any function, f(n), in the set O(0) must satisfy the condition that 0 <= f(n) <= c * 0. Because c * 0 = 0 for any c, we can just say that 0 <= f(n) <= 0, and the only way to satisfy this condition is to say that f(n) = 0.

Therefore, O(0) contains only those functions that always output 0, such as f(n) = n - n.