0% found this document useful (0 votes)
80 views10 pages

Asymptotic Notation

Here are two functions that meet the criteria: 1. n! - Factorial grows faster than any polynomial but slower than exponential functions. 2. 2^sqrt(n) - Exponential of the square root of n grows faster than any polynomial but slower than exponential functions. To prove there are infinite number of such functions: Any function of the form b^n^c where b>1 and 0<c<1 will grow faster than any polynomial n^A but slower than any exponential function a^n. Since we can choose different values of b and c, and there are infinite choices for these parameters, there are infinite number of such functions.

Uploaded by

Ani
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
80 views10 pages

Asymptotic Notation

Here are two functions that meet the criteria: 1. n! - Factorial grows faster than any polynomial but slower than exponential functions. 2. 2^sqrt(n) - Exponential of the square root of n grows faster than any polynomial but slower than exponential functions. To prove there are infinite number of such functions: Any function of the form b^n^c where b>1 and 0<c<1 will grow faster than any polynomial n^A but slower than any exponential function a^n. Since we can choose different values of b and c, and there are infinite choices for these parameters, there are infinite number of such functions.

Uploaded by

Ani
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 10

Asymptotic Notation

 How functions grow


 Asymptotic notation
 Classifying functions

A. Kostanyan
1
How Functions Grow
Complexity 33n 46n lg n 13n2 3.4n3 2n

input Solution Time


size(n) (for 1 microsecond per operation)
10 0. 00033 sec 0. 0015 sec 0. 0013 sec 0. 0034 sec 0. 001 sec

100 0. 003 sec 0. 03 sec 0. 13 sec 3. 4 sec 4 1016 yr

1 000 0. 033 sec 0. 45 sec 13 sec 0. 94 hr 

10 000 0. 33 sec 6. 1 sec 22 min 39 days 

100 000 3. 3 sec 1. 3 min 1. 5 days 108 yr 

Note: We see that algorithms whose complexity is described by a polynomial


function stay feasible for sufficiently large inputs. But if complexity is 2n, the
algorithm becomes useless except very small inputs.
A. Kostanyan
2
O-notation
Definition 1 Let g: NR+. We denote by O(g) the set of all
functions that asymptotically grow no faster than some
constant multiplied by g:
O(g)={ f: N R+ | cR+, n0N,  nn0 [f(n) cg(n)] }.
cg(n)
f(n)

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+ | cR+, n0N,  nn0 [f(n)  cg(n)] }.
f(n)

cg(n)

n0
f(n)
Lemma 2 lim  c , 0  c    f  Ω(g).
n g(n)

Examples 10n  (n ), 3n  ( 2n ), n  ( lg n), etc.

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, c2R+, n0N,
 nn0 [ c1g(n)  f(n)  c2g(n)] }.
c2g(n)
f(n)
c1g(n)

n0
f(n)
Lemma 3 lim  c, 0  c    f  Θ(g).
n g(n)

Examples 1000 n(n ), n + 10 lg n( n), etc.


A. Kostanyan
5
o, -notations
Definition 4 Let g: N R+. We denote (g) the set of all
functions that are in (g) but are not in  (g), i.e.
(g)=(g) \ (g).
f(n)
Lemma 4 lim  0  f  (g).
n g(n)

Definition 5 Let g: N R+. We denote by (g) the set


of all functions that are in  (g) but are not in (g), i.e.
(g)=(g) \ (g).

Lemma 5 f(n)
lim    f  (g).
n g(n)

A. Kostanyan
6
Problem for Thought

 Give direct definitions for the following sets of


functions:
a) (g)
b) (g)

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

k times  n  Polynomial exponential


  
cnA (c>0, A>0) n
a b (a  1,b  1)


Logarithmic Linear Factorial
clg n (c>0) cn n
n
Cubic n! 2n   , 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

 Give a function that asymptotically grows


faster than any polynomial function (that is,
nA for some constant A>0) but slower than any
exponential function (that is, an for some
constant a>1),

 Prove that there are infinite number of


functions meeting the condition above.

A. Kostanyan
10

You might also like