What is the time complexity of given function?
f(n)=n+4.
Solution:
Given,
f(n)=n+4
- n+4 >= n+4
- n+4 >= n, where n >= 1
- n+4 >= n, for all n>=1
f(n) >= n, for all n>=1
Compare with the standard Big omega notation equation that is,
f(n) >= c*g(n), for all n0>=n
Here,
g(n) = n,
c = 1
n0 = 1
- f(n)=Ω(g(n))
- f(n)=Ω(n)