Asymptoticnotation 180105065247
Asymptoticnotation 180105065247
Introduction
In mathematics, computer science, and related fields, big O
notation describes the limiting behavior of a function when the
argument tends towards a particular value or infinity, usually in
terms of simpler functions.
O(g(n)) = {f(n) :
positive constants c and n0, such
that n n0,
we have f(n) cg(n) }
Example:
i) f(n)=3n+2 and g(n)=n Prove f(n) cg(n)
ii) f(n)=100n+5 and g(n)=n2 Prove f(n) cg(n)
Big O Notation
f(n)=n^2 g(n)=2^n
-notation
For function g(n), we define (g(n)), big-
Omega of n, as the set:
(g(n)) = {f(n) :
positive constants c and n0, such
that n n0,
we have cg(n) f(n) or
f(n)>=cg(n)}
Example:
i) f(n)=3n+2 and g(n)=n Prove f(n) >= cg(n)
ii) f(n)=n3 and g(n)=n2 Prove f(n) >= cg(n)
Big Omega Notation
Q-notation
For function g(n), we define Q(g(n)), big-
Theta of n, as the set:
Q(g(n)) = {f(n) :
positive constants c1, c2, and n0,
such that n n0,
we have c1g(n) f(n) c2g(n)
}
Example:
i) f(n)=3n+2 and g(n)=n Prove
Relations Between Q, O,
Basic Asymptotic Efficiency classes
C constant, we write
O(1)
logN logarithmic
log2N log-squared
N linear
NlogN
N2 quadratic
N3 cubic
2N exponential
N! factorial
Properties of Asymptotic Notation
1. Transitive
If f(n) = Θ(g(n)) and g(n) = Θ(h(n)), then f(n) = Θ(h(n))
If f(n) = O(g(n)) and g(n) = O(h(n)), then f(n) = O(h(n))
If f(n) = Ω(g(n)) and g(n) = Ω(h(n)), then f(n) = Ω(h(n))
2. Reflexivity
f(n) = Θ(f(n))
f(n) = O(f(n))
f(n) = Ω(f(n))
3. Symmetry
f(n) = Θ(g(n)) if and only if g(n) = Θ(f(n))
4. Transpose Symmetry
f(n) = O(g(n)) if and only if g(n) = Ω(f(n))
The End