Upload
kristian-barry-mckenzie
View
214
Download
2
Tags:
Embed Size (px)
Citation preview
2
3.1 Asymptotic notation
g(n) is an asymptotic tight bound for f(n).
``=’’ abuse
}all for
)()()(0 s.t. ,,|)({))((
0
21021
nn
ngcnfngcnccnfng
))(()( ngnf
3
The definition of required every member of be asymptotically nonnegative.
n 0
n
c 2g(n)
c 1g(n)
f(n)f n g n( ) ( ( ))
4
Example:
)(6
.7 2
3214
23
222
nn
n>ifn
nnn
f n an bn c a, b, c a>
f(n)= (n ).
( ) ,
2
2
0 constants, .
In general,
).(nP(n)
aananp
d
didi
ii
Then
.0ith constant w are where)( 0
7
Theorem 3.1. For any two functions f(n) and g(n),
if and only if and
f n g n( ) ( ( ))
f n O g n( ) ( ( ))
f n g n( ) ( ( ))
8
o g n f n c n n n f n cg n( ( )) { ( )| , , ( ) ( )} 0 0 0
f n o g nf ng nn( ) ( ( )) lim( )( )
0
( ( )) { ( )| , , ( ) ( )}g n f n c n n n cg n f n 0 0 0
f n g nf ng nn( ) ( ( )) lim( )( )
9
Transitivity
Reflexivity
Symmetry
f n g n g n h n f n h n( ) ( ( )) ( ) ( ( )) ( ) ( ( )) f n O g n g n O h n f n O h n( ) ( ( )) ( ) ( ( )) ( ) ( ( )) f n g n g n h n f n h n( ) ( ( )) ( ) ( ( )) ( ) ( ( )) f n o g n g n o h n f n o h n( ) ( ( )) ( ) ( ( )) ( ) ( ( )) f n g n g n h n f n h n( ) ( ( )) ( ) ( ( )) ( ) ( ( ))
f n f n( ) ( ( ))f n O f n( ) ( ( ))f n f n( ) ( ( ))
f n g n g n f n( ) ( ( )) ( ) ( ( ))
10
Transpose symmetry f n O g n g n f n( ) ( ( )) ( ) ( ( )) f n o g n g n f n( ) ( ( )) ( ) ( ( ))
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( ) ( ( ))
11
Trichotomy a < b, a = b, or a > b. e.g., does not always hold
because the latter oscillates between n n n, sin1
20nn
12
2.2 Standard notations and common functions
Monotonicity: A function f is monotonically increasing if m n im
plies f(m) f(n). A function f is monotonically decreasing if m n i
mplies f(m) f(n). A function f is strictly increasing if m < n implies f
(m) < f(n). A function f is strictly decreasing if m > n implies f
(m) > f(n).
13
Floor and ceiling x x x x x 1 1
n n n/ /2 2
n a b n ab/ / /
n a b n ab/ / /
bbaba /))1((/
bbaba /))1((/
For any integer n
For any real x
For any real n>=0, and integers a, b >0
14
Proof of Ceiling
1/01/0
/1/0/)1(/0
100 because*
done ,/// so,
1///
and ,1///
///
// then ,0 otherwise,
/// ,0 If
0 where,Let
/// :Prove
*
barsbar
abaraabar
abrabr
abnban
mabrmabrmabnright
mbsmbsmbsbm
ba
rbmb
a
rbmb
a
rabm
banleftr
mabnbanr
abrrabmn
abnban
15
Proof of Floor
1 /0
1/010 because*
done ,/// so,
,//)( and
,//)(//
////)(
// then ,0 otherwise,
,/// ,0 If
0 where,Let
/// :Prove
*
bars
barabr
abnban
mabrmabrabmright
mbsmbsbmbarbm
barbmbarabm
banleftr
mabnbanr
abrrabmn
abnban
16
Modular arithmetic For any integer a and any positive integer n, the v
alue a mod n is the remainder (or residue) of the quotient a/n :
a mod n =a - a/n n.
If(a mod n) = (b mod n). We write a b (mod n) and say that a is equivalent to b, modulo n.
We write a ≢ b (mod n) if a is not equivalent to b modulo n.
18
Polynomials v.s. Exponentials Polynomials:
A function is polynomial bounded if f(n)=O(nk) Exponentials:
Any positive exponential function grows faster than any polynomial.
P n a ni i
i
d( )
0
n o a ab n ( ) ( )1
xnn
x
i
ix
en
x
xxxex
i
xe
)1(lim
1|| if 11
!2
0
19
Prove: nb=o(an)
nxn
n
a
n
xnxppn
nxC
xCxCxa
xaa
pbp
pp
p
n
b
ppppnpn
kn
k
nkn
kn
k
nk
nn
as 0)(
)()!1())!1((
!
)1(
),1( ,1 since
s.t.
11
1111)1(
00
21
Logarithm Basics
ac
ab
bb
c
cb
bn
b
ccc
a
bb
b
ca
ba
aa
b
aa
ana
baab
ba
, and n,, c, breal aallFor
loglog
log
log
1log
log)/1(log
log
loglog
loglog
loglog)(log
000
22
Logarithms
A function f(n) is polylogarithmically bounded if
for any constant a > 0. Any positive polynomial function grows faster
than any polylogarithmic function.
ln( ) ... | |12 3 4 5
12 3 4 5
x xx x x x
if x
1for )1ln(1
xxxx
x
k somefor )(lg)( nOnf k
)(log ab non
23
Prove: lgbn=o(na)
0lg
lim)2(
lglim
2lg
,0lim
lg
a
b
nna
b
n
a
n
b
n
n
nn
for and n for n, ang substituti
a
nBecause
24
Factorials Stirling’s approximation
))1
(1()(2!ne
nnn n
n o nn! ( )n n! ( ) 2
log( !) ( log )n n n
nn
ee
nnn
2!
where
nn n 12
1
112
1
25
Function iteration
.0))((
,0)( )1(
)(
ifinff
ifinnf i
i
For example, if , thennnf 2)( nnf ii 2)()(
26
The iterative logarithm function
nninin
in
n
)(i
)(i
iii
undefined. is lgor 0lg and 0 if undefined0lg and 0 if )lg(lg
0 if
)(lg
1
1
)1()1()(
lg ( ) min{ |lg }* ( )n i i 0 1
lg* 2 1lg* 4 2lg*16 3lg* 65536 4lg* 2 565536
h2..222* 2lg
h
27
Since the number of atoms in the observable universe is estimated to be about , which is much less than , we rarely encounter a value of n such that .
8010
655362
5lg* n