Asymptotic Notation
Asymptotic Notation
A. Kostanyan
1
How Functions Grow
Complexity 33n 46n lg n 13n2 3.4n3 2n
n0
f(n)
Lemma 1 lim c , 0 c f Ο(g).
n g(n)
Examples 10n O(n), n10 O(2n), etc.
A. Kostanyan
3
-notation
Definition 2 Let g: N R+. We denote by (g) the set of all
functions that asymptotically grow no slowly than some
constant multiplied by g:
(g)={ f: N R+ | cR+, n0N, nn0 [f(n) cg(n)] }.
f(n)
cg(n)
n0
f(n)
Lemma 2 lim c , 0 c f Ω(g).
n g(n)
A. Kostanyan
4
-notation
Definition 3 Let g: N R+. We denote by (g) the set of all
functions that are in both (g) and (g), i.e.
(g)=(g)(g), or
(g)={ f: N R+ | c1, c2R+, n0N,
nn0 [ c1g(n) f(n) c2g(n)] }.
c2g(n)
f(n)
c1g(n)
n0
f(n)
Lemma 3 lim c, 0 c f Θ(g).
n g(n)
Lemma 5 f(n)
lim f (g).
n g(n)
A. Kostanyan
6
Problem for Thought
A. Kostanyan
7
Summary
(g): functions that grow
(g): functions that at least as fast as g
grow much ( i.e., f(n) cg(n) )
faster than g
( i.e., f(n) >> cg(n) ) (g): functions that
grow at the same
(g): functions that rate as g
grow much ( i.e., f(n) cg(n) )
slower than g
( i.e., f(n) << cg(n) )
(g): functions that grow
at most as fast as g
( i.e., f(n) cg(n) )
A. Kostanyan
8
Classifying Functions
Functions Ackermann's
Constant function
2 n times
...2
A(n) 2
Iterated logarithm
Double
lg* n min k 22
... 2
…
Logarithmic Linear Factorial
clg n (c>0) cn n
n
Cubic n! 2n , e 2.7...
Linearithmic e
cn3
Polylogarithmic cn lg n
clgAn (c, А>0) Quadratic Exponential
cn 2 а n (a>1)
A. Kostanyan
9
Problem for Thought
A. Kostanyan
10