Professional Documents
Culture Documents
Fundamentals of The Analysis of Algorithm Efficiency: Asymptotic Notations and Basic Efficiency Classes
Fundamentals of The Analysis of Algorithm Efficiency: Asymptotic Notations and Basic Efficiency Classes
Chapter 2:
Fundamentals of the
Analysis of Algorithm
Efficiency
Asymptotic Notations and Basic Efficiency Classes
Section 2.2. Asymptotic Notations
and Basic Efficiency Classes
Classifying Functions by Their Asymptotic
Growth
Formal Definitions of Theta, Little oh and
Little omega
Big Oh and Big Omega
Rules to Manipulate Big-Oh Expressions
Typical Growth Rates
2
Classifying functions by their
asymptotic growth
Given a particular function g(n) , the set of all
functions can be partitioned into three sets:
Little oh : o(g(n)): the set of functions f(n) that
grow slower than g(n)
Theta: Θ (g(n)): the set of functions f(n) that
grow at same rate as g(n)
Littleomega: ω(g(n)): the set of functions f(n)
that grow faster than g(n)
3
Formal Definition of Theta
f(n) and g(n) have the same rate of
growth, if
lim( f(n) / g(n) ) = c, 0 < c < ∞, n → ∞
5
Formal Definition of Little omega
lim(f(n)/g(n)) = ∞, n → ∞
Notation: f(n) = (g(n))
6
Big Oh and Big Omega
7
f(n) = ω (g(n))
8
Rules to Manipulate Big-Oh Expressions
Let T1(N) = O(f(N)) and T2(N) = O(g(N))
9
Typical Growth Rates
C constant, we write O(1)
logN logarithmic
log2N log-squared
N linear
NlogN
N2 quadratic
N3 cubic
2N exponential
N! factorial
10