Sara
Sara

Reputation: 1

f(n) is in O(g(n)), could it have same growth as g(n)?

I know that f(n) grows slower than g(n), but could f(n) has the same growth rate as g(n) since there is an equality sign?

Upvotes: 0

Views: 40

Answers (1)

OmG
OmG

Reputation: 18838

Based on the Big-O definition, yes. For example n is in O(n) as well. In this case, f(n) = n and g(n) = n are even equal, a stronger relation than having the same growth.

Upvotes: 1

Related Questions