L1-Asymtotic Notation
L1-Asymtotic Notation
ASYMPTOTIC PERFORMANCE
🞆 Example 1
If f(n) = 2n2 , g(n) is O(n3)
f(n) ≤ c g(n)
🞆 2n2 ≤ cn3 ⇒ 2 ≤ cn ⇒ c = 1 and n0= 2
🞆 So, for c=1 and for all n ≥ 2, f(n) is big oh g(n)
🞆 Example 2
If f(n) = 8n+128, g(n) is O(n2)
To prove f(n) is big oh g(n) we have to prove that
f(n) ≤ c g(n) for all n ≥ n0 and constant c
Lets take c=1
g(n) is Θ (n2 )
Say c1 = 5 and c2 = 9
Thus c1 = 5, c2 = 9 and n0 = 28
TAKE ANOTHER EXAMPLE
NO
c2n2 cannot be larger than n3 for large n.
Thus you cannot find c1, c2 and n0
Thus f(n) ≠ Θ (n2 )
LITTLE O-NOTATION
o(g(n) ={ f(n):
for any positive constant c > 0 there
exists a constant n0 > 0 such that
0 ≤ f(n) < cg(n) for all n ≥ n0 }
Limit f/g → 0
LITTLE Ω-NOTATION
ω(g(n) ={ f(n):
for any positive constant c > 0 there
exists a constant n0 > 0 such that
0 ≤ cg(n) < f(n) for all n ≥ n0 }
Limit g/f → 0
NAMES OF MOST COMMON
BIG OH FUNCTIONS
🞆 Constant O(1)
🞆 Logarithmic O(log n)
🞆 Linear O(n)
🞆 Quadratic O(n2)
🞆 Polynomial O(nk) k is a constant
🞆 Exponential O(2n)
🞆 Exponential O(an) a is a constant and a
>1
THEOREM
🞆 R1: If d(n) is O(f(n)), then ad(n) is O(f(n),
a>0