Professional Documents
Culture Documents
Asymptotic Notation,
Notation,
Review
Review of
of Functions
Functions &
&
Summations
Summations
}
Intuitively: Set of all functions that
have the same rate of growth as g(n).
}
Technically, f(n) (g(n)).
Older usage, f(n) = (g(n)).
I’ll accept either…
10n2 - 3n = (n2)
What constants for n0, c1, and c2 will work?
Make c1 a little smaller than the leading
coefficient, and c2 a little bigger.
To compare orders of growth, look at the
leading term.
Exercise: Prove that n2/2-3n= (n2)
ymp - 6 Comp 122
Example
(g(n)) = {f(n) : positive constants c1, c2, and n0,
such that n n0, 0 c1g(n) f(n) c2g(n)}
Is 3n3 (n4) ??
How about 22n (2n)??
f (n) = O(g(n)) a b
f (n) = (g(n)) a b
f (n) = (g(n)) a = b
f (n) = o(g(n)) a < b
f (n) = (g(n)) a > b
Reflexivity
f(n) = (f(n))
f(n) = O(f(n))
f(n) = (f(n))
Complementarity
f(n) = O(g(n)) iff g(n) = (f(n))
f(n) = o(g(n)) iff g(n) = ((f(n))
n b o( a n )
lg(n!) = (n lg n)
Prove using Stirling’s approximation (in the text) for lg(n!).
A B
5n2 + 100n 3n2 + 2 A (B)
1 -2 2 2
ymp - 31 Comp 122
Review on Summations
MaxSubvector(A, n)
maxsum 0;
for i 1 to n
do for j = i to n
sum 0
for k i to j
do sum += A[k]
maxsum max(sum, maxsum)
return maxsum
n n j
T(n) = 1
i=1 j=i k=i
1 b a 1
i a
Quadratic Series:
n For n 2 0, n(n 1)(2n 1)
i 1 2 n2
2
i 1
2
i 1
i 3
13
2 3
n 3
4
x 1
For |x| < 1,
1
k 0
x
k
1 x
n 1 n2
n
(n 1)c nc c
i 1
ic c 2c nc
i 2 n
( c 1) 2
a
k 1
k ak 1 an a0
1 x 2
f ( x)dx f (k ) f ( x)dx
m1 k m m
f ( x)dx f (k ) f ( x)dx
m k m m 1
How?
n n
1 dx
k 2 k
x
ln n
1
n
1
ln n 1
k 1 k