SlideShare ist ein Scribd-Unternehmen logo
1 von 8
Downloaden Sie, um offline zu lesen
1
CMPS 102
Introduction to Analysis of Algorithms
Fall 2003
Asymptotic Growth of Functions
We introduce several types of asymptotic notation which are used to compare the performance and
efficiency of algorithms. As we’ll see, the asymptotic run time of an algorithm gives a simple, and
machine independent, characterization of it’s complexity.
Definition Let )(ng be a function. The set ))(( ngO is defined as
})()(0:,0,0|)({))(( 00 ncgnfnnncnfngO ≤≤≥∀>∃>∃= .
In other words, ))(()( ngOnf ∈ if and only if there exist positive constants c, and 0n , such that for all
0nn ≥ , the inequality )()(0 ncgnf ≤≤ is satisfied. We say that )(nf is Big O of )(ng , or that )(ng
is an asymptotic upper bound for )(nf .
We often abuse notation slightly by writing ))(()( ngOnf = to mean ))(()( ngOnf ∈ . Actually
))(()( ngOnf ∈ is also an abuse of notation. We should really write )(gOf ∈ since what we have
defined is a set of functions, not a set of numbers. The notational convention ))(( ngO is useful since
it allows us to refer to the set )( 3
nO say, without having to introduce a function symbol for the
polynomial 3
n . Observe that if ))(()( ngOnf = then )(nf is asymptotically non-negative, i.e. )(nf is
non-negative for all sufficiently large n, and likewise for )(ng . We make the blanket assumption from
now on that all functions under discussion are asymptotically non-negative.
In practice we will be concerned with integer valued functions of a (positive) integer n ( ++
→ ZZ:g ).
However, in what follows, it is useful to consider n to be a continuous real variable taking positive
values and g to be real valued function ( ++
→ RR:g ).
Geometrically ))(()( ngOnf = says:
)(ncg
)(nf
0n
2
Example )30010(10040 2
++=+ nnOn . Observe that 30010100400 2
++≤+≤ nnn for all 20≥n ,
as can be easily verified. Thus we may take 200 =n and 1=c in the definition.
300102
++ nn
300 10040 +n
100
10 20
Note that in this example, any value of 0n greater than 20 will also work, and likewise any value of c
greater than 1 works. In general if there exist positive constants 0n and c such that )()(0 ncgnf ≤≤
for all 0nn ≥ , then infinitely many such constants also exist. In order to prove that ))(()( ngOnf = it
is not necessary to find the smallest possible 0n and c making the )()(0 ncgnf ≤≤ true. It is only
necessary to show that at least one pair of such constants exist.
Generalizing the last example, we will show that )( 2
edncnOban ++=+ for any constants a-e, and in
fact ))(()( nqOnp = whenever )(np and )(nq are polynomials with )deg()deg( qp ≤ .
Definition Let )(ng be a function and define the set ))(( ngΩ to be
})()(0:,0,0|)({))(( 00 nfncgnnncnfng ≤≤≥∀>∃>∃=Ω .
We say )(nf is big Omega of )(ng , and that )(ng is an asymptotic lower bound for )(nf . As before
we write ))(()( ngnf Ω= to mean ))(()( ngnf Ω∈ . The geometric interpretation is:
)(nf
)(ncg
0n
3
Lemma ))(()( ngOnf = if and only if ))(()( nfng Ω= .
Proof: If ))(()( ngOnf = then there exist positive numbers 1c , 1n such that )()(0 1 ngcnf ≤≤ for all
1nn ≥ . Let 12 /1 cc = and 12 nn = . Then )()(0 2 ngnfc ≤≤ for all 2nn ≥ , proving ))(()( nfng Ω= .
The converse is similar and we leave it to the reader. ///
Definition Let )(ng be a function and define the set ))(())(())(( ngngOng Ω∩=Θ . Equivalently
})()()(0:,0,0,0|)({))(( 210021 ngcnfngcnnnccnfng ≤≤≤≥∀>∃>∃>∃=Θ .
We write ))(()( ngnf Θ= and say the )(ng is an asymptotically tight bound for )(nf , or that )(nf
and )(ng are asymptotically equivalent. We interpret this geometrically as:
)(2 ngc
)(nf
)(1 ngc
0n
Exercise Prove that if c is a positive constant, then ))(()( nfncf Θ= .
Exercise Prove that ))(()( ngnf Θ= if and only if ))(()( nfng Θ= .
Example Prove that ( )nn Θ=+10 .
Proof: According to the definition, we must find positive numbers 021 ,, ncc , such that the inequality
ncnnc 21 100 ≤+≤≤ holds for all 0nn ≥ . Pick 11 =c , 22 =c , and 100 =n . Then if 0nn ≥ we
have:
010 ≤− and n≤10
∴ n)11(10 −≤− and n)12(10 −≤
∴ nc )1(10 2
1−≤− and nc )1(10 2
2 −≤
∴ 102
1 +≤ nnc and ncn 2
210 ≤+ ,
∴ ncnnc 2
2
2
1 10 ≤+≤ ,
∴ ncnnc 21 10 ≤+≤ ,
as required. ///
4
The reader may find our choice of values for the constants 021 ,, ncc in this example somewhat
mysterious. Adequate values for these constants can usually be obtained by working backwards
algebraically from the inequality to be proved. Notice that in this example there are many valid
choices. For instance one checks easily that 2/11 =c , 2/32 =c , and 200 =n work equally well.
Exercise Let a, b be real numbers with 0>b . Prove directly from the definition (as above) that
)()( bb
nan Θ=+ . (In what follows we learn a much easier way to prove this.)
Lemma If )()( nhnf ≤ for all sufficiently large n, and if ))(()( ngOnh = , then ))(()( ngOnf = .
Proof: The above hypotheses say that there exist positive numbers c and 1n such that )()( ncgnh ≤
for all 1nn ≥ . Also there exists 2n such that )()(0 nhnf ≤≤ for all 2nn ≥ . (Recall )(nf is assumed
to be asymptotically non-negative.) Define ),max( 210 nnn = , so that if 0nn ≥ we have both 1nn ≥ and
2nn ≥ . Thus 0nn ≥ implies )()(0 ncgnf ≤≤ , and therefore ))(()( ngOnf = . ///
Exercise Prove that if )()()( 21 nhnfnh ≤≤ for all sufficiently large n, where ))(()(1 ngnh Ω= and
))(()(2 ngOnh = , then ))(()( ngnf Θ= .
Example Let 1≥k be a fixed integer. Prove that )( 1
1
+
=
Θ= k
n
i
k
ni .
Proof: Observe that )( 11
11
++
==
==⋅=≤ kkk
n
i
k
n
i
k
nOnnnni , and
)()2/1()2/)(2/()2/(2/)2/( 111
2/2/1
+++
===
Ω==≥⋅≥≥≥ kkkkk
n
ni
k
n
ni
k
n
i
k
nnnnnnnii .
By the result of the preceding exercise, we conclude )( 1
1
+
=
Θ= k
n
i
k
ni . ///
When asymptotic notation appears in a formula such as )()2/(2)( nnTnT Θ+= we interpret )(nΘ to
stand for some anonymous function in the class )(nΘ . For example )(31243 2323
nnnnn Θ+=+−+ .
Here )( 2
nΘ stands for 124 2
+− nn , which belongs to the class )( 2
nΘ .
The expression =
Θ
n
i
i1
)( can be puzzling. On the surface it stands for )()3()2()1( nΘ++Θ+Θ+Θ ,
which is meaningless since )constant(Θ consists of all functions which are bounded above by some
constant. We interpret )(iΘ in this expression to stand for a single function )(if in the class )(iΘ ,
evaluated at ni ,,3,2,1= .
Exercise Prove that )()( 2
1
ni
n
i
Θ=Θ=
. The left hand side stands for a single function )(if summed
for ni ,,3,2,1= . By the previous exercise it is sufficient to show that )()()( 211 nhifnh
n
i
≤≤ =
for
all sufficiently large n, where )()( 2
1 nnh Ω= and )()( 2
2 nOnh = .
5
Definition })()(0:,0,0|)({))(( 00 ncgnfnnncnfngo <≤≥∀>∃>∀= . We say that )(ng is a
strict Asymptotic upper bound for )(nf and write ))(()( ngonf = as before.
Lemma ))(()( ngonf = if and only if 0
)(
)(
lim =
∞→ ng
nf
n
.
Proof: Observe that ))(()( ngonf = if and only if c
ng
nf
nnnc <≤≥∀>∃>∀
)(
)(
0:,0,0 00 , which is the
very definition of the limit statement 0
)(
)(
lim =
∞→ ng
nf
n
. ///
Example )()lg( non = since 0
)lg(
lim =
∞→ n
n
n
. (Apply l’Hopitals rule.)
Example )( nk
bon = for any 0>k and 1>b since 0lim =
∞→ n
k
n b
n
. (Apply l’Hopitals rule k times.) In
other words, any exponential grows strictly faster than any polynomial.
By comparing definitions of ))(( ngo and ))(( ngO one sees immediately that ))(())(( ngOngo ⊆ .
Also no function can belong to both ))(( ngo and ))(( ngΩ , as is easily verified (exercise). Thus
∅=Ω∩ ))(())(( ngngo , and therefore ))(())(())(( ngngOngo Θ−⊆ .
Definition })()(0:,0,0|)({))(( 00 nfncgnnncnfng <≤≥∀>∃>∀=ω . Here we say that )(ng is
a strict asymptotic lower bound for )(nf and write ))(()( ngnf ω= .
Exercise Prove that ))(()( ngnf ω= if and only if ∞=
∞→ )(
)(
lim
ng
nf
n
.
Exercise Prove ∅=∩ ))(())(( ngOngω , whence ))(())(())(( ngngng Θ−Ω⊆ω .
The following picture emerges:
))(( ngO ))(( ngΩ
))(( ngo ))(( ngΘ ))(( ngω
6
Lemma If L
ng
nf
n
=
∞→ )(
)(
lim , where ∞<≤ L0 , then ))(()( ngOnf = .
Proof: The definition of the above limit is εε <−≥∀>∃>∀ L
ng
nf
nnn
)(
)(
:,0,0 00 . Thus if we let
1=ε , there exists a positive number 0n such that for all 0nn ≥ :
1
)(
)(
<− L
ng
nf
∴ 1
)(
)(
1 <−<− L
ng
nf
∴ 1
)(
)(
+< L
ng
nf
∴ )()1()( ngLnf ⋅+< .
Now take 1+= Lc in the definition of O , so that ))(()( ngOnf = as claimed. ///
Lemma If L
ng
nf
n
=
∞→ )(
)(
lim , where ∞≤< L0 , then ))(()( ngnf Ω= .
Proof: The limit statement implies L
nf
ng
n
′=
∞→ )(
)(
lim , where LL /1=′ and hence ∞<′≤ L0 . By the
previous lemma ))(()( nfOng = , and therefore ))(()( ngnf Ω= . ///
Exercise Prove that if L
ng
nf
n
=
∞→ )(
)(
lim , where ∞<< L0 , then ))(()( ngnf Θ= .
Although ))(( ngo , ))(( ngω , and a certain subset of ))(( ngΘ are characterized by limits, the full sets
))(( ngO , ))(( ngΩ , and ))(( ngΘ have no such characterization as the following examples show.
Example A Let nng =)( and nnnf ⋅+= ))sin(1()( .
)(2 ng
)(nf
Clearly ))(()( ngOnf = , but )sin(1
)(
)(
n
ng
nf
+= , whose limit does not exist. This example shows that
the containment ))(())(())(( ngngOngo Θ−⊆ is in general strict since ))(()( ngnf Ω≠ (exercise).
Therefore ))(()( ngnf Θ≠ , so that ))(())(()( ngngOnf Θ−∈ . But ))(()( ngonf ≠ since the limit does
not exist.
7
Example B Let nng =)( and nnnf ⋅+= ))sin(2()( .
)(3 ng
)(nf
)(ng
Since nnnn 3))sin(2( ≤⋅+≤ for all 0≥n , we have ))(()( ngnf Θ= , but )sin(2
)(
)(
n
ng
nf
+= whose
limit does not exist.
Exercise Find functions )(nf and )(ng such that ))(())(()( ngngnf Θ−Ω∈ , but
)(
)(
lim
ng
nf
n ∞→
does not
exist (even in the sense of being infinite), so that ))(()( ngnf ω≠ .
The preceding limit theorems and counter-examples can be summarized in the following diagram.
Here L denotes the limit
)(
)(
lim
ng
nf
L
n ∞→
= , if it exists.
))(( ngO ))(( ngΩ
))(( ngΘ
))(( ngo ))(( ngω
0=L ∞<< L0 ∞=L
Ex A Ex B
In spite of the above counter-examples, the preceding limit theorems are a very useful tool for
establishing asymptotic comparisons between functions. For instance recall the earlier exercise to
show )()( bb
nan Θ=+ for real numbers a, and b with 0>b . The result follows immediately from
111lim
)(
lim ==+=
+
∞→∞→
b
b
nb
b
n n
a
n
an
,
since ∞<<10 .
8
Exercise Use limits to prove the following:
a. )()lg( 2
nonn = (here )lg(n denotes the base 2 logarithm of n.)
b. )(2 105
nn n
ω= .
c. If )(nP is a polynomial of degree 0≥k , then )()( k
nnP Θ= .
d. ))(())(()( nfnfonf Θ=+ . (One can always disregard lower order terms)
e. )()(log ε
non k
= for any 0>k and 0>ε . (Polynomials grow faster than logs.)
f. )( n
bon =ε
for any 0>ε and 1>b . (Exponentials grow faster than polynomials.)
There is an analogy between the asymptotic comparison of functions )(nf and )(ng , and the
comparison of real numbers x and y.
))(()( ngOnf = ~ yx ≤
))(()( ngnf Θ= ~ yx =
))(()( ngnf Ω= ~ yx ≥
))(()( ngonf = ~ yx <
))(()( ngnf ω= ~ yx >
Note however that this analogy is not exact since there exist pairs of functions which are not
comparable, while any two real numbers are comparable. (See problem 3-2c, p.58.)

Weitere ähnliche Inhalte

Was ist angesagt?

Topic: Fourier Series ( Periodic Function to change of interval)
Topic: Fourier Series ( Periodic Function to  change of interval)Topic: Fourier Series ( Periodic Function to  change of interval)
Topic: Fourier Series ( Periodic Function to change of interval)Abhishek Choksi
 
Applied Calculus Chapter 2 vector valued function
Applied Calculus Chapter  2 vector valued functionApplied Calculus Chapter  2 vector valued function
Applied Calculus Chapter 2 vector valued functionJ C
 
Operational research
Operational researchOperational research
Operational researchAlbi Thomas
 
Fourier series of odd functions with period 2 l
Fourier series of odd functions with period 2 lFourier series of odd functions with period 2 l
Fourier series of odd functions with period 2 lPepa Vidosa Serradilla
 
Lesson 7: Vector-valued functions
Lesson 7: Vector-valued functionsLesson 7: Vector-valued functions
Lesson 7: Vector-valued functionsMatthew Leingang
 
Introduction to Fourier transform and signal analysis
Introduction to Fourier transform and signal analysisIntroduction to Fourier transform and signal analysis
Introduction to Fourier transform and signal analysis宗翰 謝
 
Fourier series example
Fourier series exampleFourier series example
Fourier series exampleAbi finni
 
Complex analysis and differential equation
Complex analysis and differential equationComplex analysis and differential equation
Complex analysis and differential equationSpringer
 
Fourier series Introduction
Fourier series IntroductionFourier series Introduction
Fourier series IntroductionRizwan Kazi
 
Sawinder Pal Kaur PhD Thesis
Sawinder Pal Kaur PhD ThesisSawinder Pal Kaur PhD Thesis
Sawinder Pal Kaur PhD ThesisSawinder Pal Kaur
 

Was ist angesagt? (20)

Fourier series 2
Fourier series 2Fourier series 2
Fourier series 2
 
Topic: Fourier Series ( Periodic Function to change of interval)
Topic: Fourier Series ( Periodic Function to  change of interval)Topic: Fourier Series ( Periodic Function to  change of interval)
Topic: Fourier Series ( Periodic Function to change of interval)
 
Chapter 2 (maths 3)
Chapter 2 (maths 3)Chapter 2 (maths 3)
Chapter 2 (maths 3)
 
big_oh
big_ohbig_oh
big_oh
 
residue
residueresidue
residue
 
Fourier series
Fourier seriesFourier series
Fourier series
 
Applied Calculus Chapter 2 vector valued function
Applied Calculus Chapter  2 vector valued functionApplied Calculus Chapter  2 vector valued function
Applied Calculus Chapter 2 vector valued function
 
Chapter 3 (maths 3)
Chapter 3 (maths 3)Chapter 3 (maths 3)
Chapter 3 (maths 3)
 
Operational research
Operational researchOperational research
Operational research
 
mathematics formulas
mathematics formulasmathematics formulas
mathematics formulas
 
Fourier series of odd functions with period 2 l
Fourier series of odd functions with period 2 lFourier series of odd functions with period 2 l
Fourier series of odd functions with period 2 l
 
Lesson 7: Vector-valued functions
Lesson 7: Vector-valued functionsLesson 7: Vector-valued functions
Lesson 7: Vector-valued functions
 
Ps02 cmth03 unit 1
Ps02 cmth03 unit 1Ps02 cmth03 unit 1
Ps02 cmth03 unit 1
 
Introduction to Fourier transform and signal analysis
Introduction to Fourier transform and signal analysisIntroduction to Fourier transform and signal analysis
Introduction to Fourier transform and signal analysis
 
Time complexity
Time complexityTime complexity
Time complexity
 
Fourier series example
Fourier series exampleFourier series example
Fourier series example
 
Complex analysis and differential equation
Complex analysis and differential equationComplex analysis and differential equation
Complex analysis and differential equation
 
AEM Fourier series
 AEM Fourier series AEM Fourier series
AEM Fourier series
 
Fourier series Introduction
Fourier series IntroductionFourier series Introduction
Fourier series Introduction
 
Sawinder Pal Kaur PhD Thesis
Sawinder Pal Kaur PhD ThesisSawinder Pal Kaur PhD Thesis
Sawinder Pal Kaur PhD Thesis
 

Andere mochten auch

Скорость роста функций
Скорость роста функцийСкорость роста функций
Скорость роста функцийDEVTYPE
 
Разбор задач по дискретной вероятности
Разбор задач по дискретной вероятностиРазбор задач по дискретной вероятности
Разбор задач по дискретной вероятностиDEVTYPE
 
ЖАДНЫЕ АЛГОРИТМЫ
ЖАДНЫЕ АЛГОРИТМЫ ЖАДНЫЕ АЛГОРИТМЫ
ЖАДНЫЕ АЛГОРИТМЫ DEVTYPE
 
Зачем изучать алгоритмы?
Зачем изучать алгоритмы?Зачем изучать алгоритмы?
Зачем изучать алгоритмы?DEVTYPE
 
Жадные алгоритмы: введение
Жадные алгоритмы: введениеЖадные алгоритмы: введение
Жадные алгоритмы: введениеDEVTYPE
 
Continuity and Uniform Continuity
Continuity and Uniform ContinuityContinuity and Uniform Continuity
Continuity and Uniform ContinuityDEVTYPE
 
Разбор задач модуля "Теория графов ll"
Разбор задач модуля "Теория графов ll"Разбор задач модуля "Теория графов ll"
Разбор задач модуля "Теория графов ll"DEVTYPE
 
D-кучи и их применение
D-кучи и их применениеD-кучи и их применение
D-кучи и их применениеDEVTYPE
 
Диаграммы Юнга, плоские разбиения и знакочередующиеся матрицы
Диаграммы Юнга, плоские разбиения и знакочередующиеся матрицыДиаграммы Юнга, плоские разбиения и знакочередующиеся матрицы
Диаграммы Юнга, плоские разбиения и знакочередующиеся матрицыDEVTYPE
 
Лекция 7: Бинарные кучи (пирамиды)
Лекция 7: Бинарные кучи (пирамиды)Лекция 7: Бинарные кучи (пирамиды)
Лекция 7: Бинарные кучи (пирамиды)Mikhail Kurnosov
 
Алгоритмы и структуры данных осень 2013 лекция 8
Алгоритмы и структуры данных осень 2013 лекция 8Алгоритмы и структуры данных осень 2013 лекция 8
Алгоритмы и структуры данных осень 2013 лекция 8Technopark
 
С. Дасгупта, Х. Пападимитриу, У. Вазирани. Алгоритмы
С. Дасгупта, Х. Пападимитриу, У. Вазирани. АлгоритмыС. Дасгупта, Х. Пападимитриу, У. Вазирани. Алгоритмы
С. Дасгупта, Х. Пападимитриу, У. Вазирани. АлгоритмыDEVTYPE
 
Логарифм и экспонента
Логарифм и экспонентаЛогарифм и экспонента
Логарифм и экспонентаDEVTYPE
 
Математическая индукция
Математическая индукцияМатематическая индукция
Математическая индукцияDEVTYPE
 
Разбор задач пятого модуля
Разбор задач пятого модуляРазбор задач пятого модуля
Разбор задач пятого модуляDEVTYPE
 
Тестовое задание для веб-программиста
Тестовое задание для веб-программистаТестовое задание для веб-программиста
Тестовое задание для веб-программистаDEVTYPE
 
Задача №1. Работа с видео.
Задача №1. Работа с видео.Задача №1. Работа с видео.
Задача №1. Работа с видео.DEVTYPE
 
Рукописные лекции по линейной алгебре
Рукописные лекции по линейной алгебреРукописные лекции по линейной алгебре
Рукописные лекции по линейной алгебреDEVTYPE
 
Задачи №2. Работа со звуком.
Задачи №2. Работа со звуком.Задачи №2. Работа со звуком.
Задачи №2. Работа со звуком.DEVTYPE
 
Программирование: теоремы и задачи
Программирование: теоремы и задачиПрограммирование: теоремы и задачи
Программирование: теоремы и задачиDEVTYPE
 

Andere mochten auch (20)

Скорость роста функций
Скорость роста функцийСкорость роста функций
Скорость роста функций
 
Разбор задач по дискретной вероятности
Разбор задач по дискретной вероятностиРазбор задач по дискретной вероятности
Разбор задач по дискретной вероятности
 
ЖАДНЫЕ АЛГОРИТМЫ
ЖАДНЫЕ АЛГОРИТМЫ ЖАДНЫЕ АЛГОРИТМЫ
ЖАДНЫЕ АЛГОРИТМЫ
 
Зачем изучать алгоритмы?
Зачем изучать алгоритмы?Зачем изучать алгоритмы?
Зачем изучать алгоритмы?
 
Жадные алгоритмы: введение
Жадные алгоритмы: введениеЖадные алгоритмы: введение
Жадные алгоритмы: введение
 
Continuity and Uniform Continuity
Continuity and Uniform ContinuityContinuity and Uniform Continuity
Continuity and Uniform Continuity
 
Разбор задач модуля "Теория графов ll"
Разбор задач модуля "Теория графов ll"Разбор задач модуля "Теория графов ll"
Разбор задач модуля "Теория графов ll"
 
D-кучи и их применение
D-кучи и их применениеD-кучи и их применение
D-кучи и их применение
 
Диаграммы Юнга, плоские разбиения и знакочередующиеся матрицы
Диаграммы Юнга, плоские разбиения и знакочередующиеся матрицыДиаграммы Юнга, плоские разбиения и знакочередующиеся матрицы
Диаграммы Юнга, плоские разбиения и знакочередующиеся матрицы
 
Лекция 7: Бинарные кучи (пирамиды)
Лекция 7: Бинарные кучи (пирамиды)Лекция 7: Бинарные кучи (пирамиды)
Лекция 7: Бинарные кучи (пирамиды)
 
Алгоритмы и структуры данных осень 2013 лекция 8
Алгоритмы и структуры данных осень 2013 лекция 8Алгоритмы и структуры данных осень 2013 лекция 8
Алгоритмы и структуры данных осень 2013 лекция 8
 
С. Дасгупта, Х. Пападимитриу, У. Вазирани. Алгоритмы
С. Дасгупта, Х. Пападимитриу, У. Вазирани. АлгоритмыС. Дасгупта, Х. Пападимитриу, У. Вазирани. Алгоритмы
С. Дасгупта, Х. Пападимитриу, У. Вазирани. Алгоритмы
 
Логарифм и экспонента
Логарифм и экспонентаЛогарифм и экспонента
Логарифм и экспонента
 
Математическая индукция
Математическая индукцияМатематическая индукция
Математическая индукция
 
Разбор задач пятого модуля
Разбор задач пятого модуляРазбор задач пятого модуля
Разбор задач пятого модуля
 
Тестовое задание для веб-программиста
Тестовое задание для веб-программистаТестовое задание для веб-программиста
Тестовое задание для веб-программиста
 
Задача №1. Работа с видео.
Задача №1. Работа с видео.Задача №1. Работа с видео.
Задача №1. Работа с видео.
 
Рукописные лекции по линейной алгебре
Рукописные лекции по линейной алгебреРукописные лекции по линейной алгебре
Рукописные лекции по линейной алгебре
 
Задачи №2. Работа со звуком.
Задачи №2. Работа со звуком.Задачи №2. Работа со звуком.
Задачи №2. Работа со звуком.
 
Программирование: теоремы и задачи
Программирование: теоремы и задачиПрограммирование: теоремы и задачи
Программирование: теоремы и задачи
 

Ähnlich wie Asymptotic Growth of Functions

asymptotic notations i
asymptotic notations iasymptotic notations i
asymptotic notations iAli mahmood
 
Lecture 3(a) Asymptotic-analysis.pdf
Lecture 3(a) Asymptotic-analysis.pdfLecture 3(a) Asymptotic-analysis.pdf
Lecture 3(a) Asymptotic-analysis.pdfShaistaRiaz4
 
Asymptotic notation
Asymptotic notationAsymptotic notation
Asymptotic notationsajinis3
 
02 asymptotic notations
02 asymptotic notations02 asymptotic notations
02 asymptotic notationsTarikuDabala1
 
Asymptotic Notation and Complexity
Asymptotic Notation and ComplexityAsymptotic Notation and Complexity
Asymptotic Notation and ComplexityRajandeep Gill
 
Lecture 4 - Growth of Functions (1).ppt
Lecture 4 - Growth of Functions (1).pptLecture 4 - Growth of Functions (1).ppt
Lecture 4 - Growth of Functions (1).pptZohairMughal1
 
Lecture 4 - Growth of Functions.ppt
Lecture 4 - Growth of Functions.pptLecture 4 - Growth of Functions.ppt
Lecture 4 - Growth of Functions.pptZohairMughal1
 
Unit-1 DAA_Notes.pdf
Unit-1 DAA_Notes.pdfUnit-1 DAA_Notes.pdf
Unit-1 DAA_Notes.pdfAmayJaiswal4
 
Asymptotic notations
Asymptotic notationsAsymptotic notations
Asymptotic notationsEhtisham Ali
 
Asymptotic notations
Asymptotic notationsAsymptotic notations
Asymptotic notationsNikhil Sharma
 
Analysis Of Algorithms I
Analysis Of Algorithms IAnalysis Of Algorithms I
Analysis Of Algorithms ISri Prasanna
 
Anlysis and design of algorithms part 1
Anlysis and design of algorithms part 1Anlysis and design of algorithms part 1
Anlysis and design of algorithms part 1Deepak John
 

Ähnlich wie Asymptotic Growth of Functions (20)

asymptotic notations i
asymptotic notations iasymptotic notations i
asymptotic notations i
 
Lecture 3(a) Asymptotic-analysis.pdf
Lecture 3(a) Asymptotic-analysis.pdfLecture 3(a) Asymptotic-analysis.pdf
Lecture 3(a) Asymptotic-analysis.pdf
 
Asymptotic Notation
Asymptotic NotationAsymptotic Notation
Asymptotic Notation
 
Analysis of algorithms
Analysis of algorithmsAnalysis of algorithms
Analysis of algorithms
 
Asymptotic notations
Asymptotic notationsAsymptotic notations
Asymptotic notations
 
Asymptotic notation
Asymptotic notationAsymptotic notation
Asymptotic notation
 
02 asymptotic notations
02 asymptotic notations02 asymptotic notations
02 asymptotic notations
 
Asymptotic Notation and Complexity
Asymptotic Notation and ComplexityAsymptotic Notation and Complexity
Asymptotic Notation and Complexity
 
Asymptotic notation
Asymptotic notationAsymptotic notation
Asymptotic notation
 
stochastic processes assignment help
stochastic processes assignment helpstochastic processes assignment help
stochastic processes assignment help
 
Lecture3(b).pdf
Lecture3(b).pdfLecture3(b).pdf
Lecture3(b).pdf
 
Lecture 4 - Growth of Functions (1).ppt
Lecture 4 - Growth of Functions (1).pptLecture 4 - Growth of Functions (1).ppt
Lecture 4 - Growth of Functions (1).ppt
 
Lecture 4 - Growth of Functions.ppt
Lecture 4 - Growth of Functions.pptLecture 4 - Growth of Functions.ppt
Lecture 4 - Growth of Functions.ppt
 
Unit-1 DAA_Notes.pdf
Unit-1 DAA_Notes.pdfUnit-1 DAA_Notes.pdf
Unit-1 DAA_Notes.pdf
 
Asymptotic notations
Asymptotic notationsAsymptotic notations
Asymptotic notations
 
02 asymp
02 asymp02 asymp
02 asymp
 
Theta notation
Theta notationTheta notation
Theta notation
 
Asymptotic notations
Asymptotic notationsAsymptotic notations
Asymptotic notations
 
Analysis Of Algorithms I
Analysis Of Algorithms IAnalysis Of Algorithms I
Analysis Of Algorithms I
 
Anlysis and design of algorithms part 1
Anlysis and design of algorithms part 1Anlysis and design of algorithms part 1
Anlysis and design of algorithms part 1
 

Mehr von DEVTYPE

1.4 Точечные оценки и их свойства
1.4 Точечные оценки и их свойства1.4 Точечные оценки и их свойства
1.4 Точечные оценки и их свойстваDEVTYPE
 
1.3 Описательная статистика
1.3 Описательная статистика1.3 Описательная статистика
1.3 Описательная статистикаDEVTYPE
 
1.2 Выборка. Выборочное пространство
1.2 Выборка. Выборочное пространство1.2 Выборка. Выборочное пространство
1.2 Выборка. Выборочное пространствоDEVTYPE
 
Coin Change Problem
Coin Change ProblemCoin Change Problem
Coin Change ProblemDEVTYPE
 
Кучи
КучиКучи
КучиDEVTYPE
 
Кодирование Хаффмана
Кодирование ХаффманаКодирование Хаффмана
Кодирование ХаффманаDEVTYPE
 
Наибольший общий делитель
Наибольший общий делительНаибольший общий делитель
Наибольший общий делительDEVTYPE
 
Числа Фибоначчи
Числа ФибоначчиЧисла Фибоначчи
Числа ФибоначчиDEVTYPE
 
О-символика
О-символикаО-символика
О-символикаDEVTYPE
 
7. Дискретная вероятность
7. Дискретная вероятность7. Дискретная вероятность
7. Дискретная вероятностьDEVTYPE
 
Основы комбинаторики II. Разбор задач
Основы комбинаторики II. Разбор задачОсновы комбинаторики II. Разбор задач
Основы комбинаторики II. Разбор задачDEVTYPE
 

Mehr von DEVTYPE (11)

1.4 Точечные оценки и их свойства
1.4 Точечные оценки и их свойства1.4 Точечные оценки и их свойства
1.4 Точечные оценки и их свойства
 
1.3 Описательная статистика
1.3 Описательная статистика1.3 Описательная статистика
1.3 Описательная статистика
 
1.2 Выборка. Выборочное пространство
1.2 Выборка. Выборочное пространство1.2 Выборка. Выборочное пространство
1.2 Выборка. Выборочное пространство
 
Coin Change Problem
Coin Change ProblemCoin Change Problem
Coin Change Problem
 
Кучи
КучиКучи
Кучи
 
Кодирование Хаффмана
Кодирование ХаффманаКодирование Хаффмана
Кодирование Хаффмана
 
Наибольший общий делитель
Наибольший общий делительНаибольший общий делитель
Наибольший общий делитель
 
Числа Фибоначчи
Числа ФибоначчиЧисла Фибоначчи
Числа Фибоначчи
 
О-символика
О-символикаО-символика
О-символика
 
7. Дискретная вероятность
7. Дискретная вероятность7. Дискретная вероятность
7. Дискретная вероятность
 
Основы комбинаторики II. Разбор задач
Основы комбинаторики II. Разбор задачОсновы комбинаторики II. Разбор задач
Основы комбинаторики II. Разбор задач
 

Kürzlich hochgeladen

Pests of cotton_Borer_Pests_Binomics_Dr.UPR.pdf
Pests of cotton_Borer_Pests_Binomics_Dr.UPR.pdfPests of cotton_Borer_Pests_Binomics_Dr.UPR.pdf
Pests of cotton_Borer_Pests_Binomics_Dr.UPR.pdfPirithiRaju
 
GBSN - Microbiology (Unit 2)
GBSN - Microbiology (Unit 2)GBSN - Microbiology (Unit 2)
GBSN - Microbiology (Unit 2)Areesha Ahmad
 
GBSN - Biochemistry (Unit 1)
GBSN - Biochemistry (Unit 1)GBSN - Biochemistry (Unit 1)
GBSN - Biochemistry (Unit 1)Areesha Ahmad
 
All-domain Anomaly Resolution Office U.S. Department of Defense (U) Case: “Eg...
All-domain Anomaly Resolution Office U.S. Department of Defense (U) Case: “Eg...All-domain Anomaly Resolution Office U.S. Department of Defense (U) Case: “Eg...
All-domain Anomaly Resolution Office U.S. Department of Defense (U) Case: “Eg...Sérgio Sacani
 
Forensic Biology & Its biological significance.pdf
Forensic Biology & Its biological significance.pdfForensic Biology & Its biological significance.pdf
Forensic Biology & Its biological significance.pdfrohankumarsinghrore1
 
GUIDELINES ON SIMILAR BIOLOGICS Regulatory Requirements for Marketing Authori...
GUIDELINES ON SIMILAR BIOLOGICS Regulatory Requirements for Marketing Authori...GUIDELINES ON SIMILAR BIOLOGICS Regulatory Requirements for Marketing Authori...
GUIDELINES ON SIMILAR BIOLOGICS Regulatory Requirements for Marketing Authori...Lokesh Kothari
 
Formation of low mass protostars and their circumstellar disks
Formation of low mass protostars and their circumstellar disksFormation of low mass protostars and their circumstellar disks
Formation of low mass protostars and their circumstellar disksSérgio Sacani
 
SAMASTIPUR CALL GIRL 7857803690 LOW PRICE ESCORT SERVICE
SAMASTIPUR CALL GIRL 7857803690  LOW PRICE  ESCORT SERVICESAMASTIPUR CALL GIRL 7857803690  LOW PRICE  ESCORT SERVICE
SAMASTIPUR CALL GIRL 7857803690 LOW PRICE ESCORT SERVICEayushi9330
 
VIRUSES structure and classification ppt by Dr.Prince C P
VIRUSES structure and classification ppt by Dr.Prince C PVIRUSES structure and classification ppt by Dr.Prince C P
VIRUSES structure and classification ppt by Dr.Prince C PPRINCE C P
 
Presentation Vikram Lander by Vedansh Gupta.pptx
Presentation Vikram Lander by Vedansh Gupta.pptxPresentation Vikram Lander by Vedansh Gupta.pptx
Presentation Vikram Lander by Vedansh Gupta.pptxgindu3009
 
Botany krishna series 2nd semester Only Mcq type questions
Botany krishna series 2nd semester Only Mcq type questionsBotany krishna series 2nd semester Only Mcq type questions
Botany krishna series 2nd semester Only Mcq type questionsSumit Kumar yadav
 
Hire 💕 9907093804 Hooghly Call Girls Service Call Girls Agency
Hire 💕 9907093804 Hooghly Call Girls Service Call Girls AgencyHire 💕 9907093804 Hooghly Call Girls Service Call Girls Agency
Hire 💕 9907093804 Hooghly Call Girls Service Call Girls AgencySheetal Arora
 
Biopesticide (2).pptx .This slides helps to know the different types of biop...
Biopesticide (2).pptx  .This slides helps to know the different types of biop...Biopesticide (2).pptx  .This slides helps to know the different types of biop...
Biopesticide (2).pptx .This slides helps to know the different types of biop...RohitNehra6
 
Hubble Asteroid Hunter III. Physical properties of newly found asteroids
Hubble Asteroid Hunter III. Physical properties of newly found asteroidsHubble Asteroid Hunter III. Physical properties of newly found asteroids
Hubble Asteroid Hunter III. Physical properties of newly found asteroidsSérgio Sacani
 
Labelling Requirements and Label Claims for Dietary Supplements and Recommend...
Labelling Requirements and Label Claims for Dietary Supplements and Recommend...Labelling Requirements and Label Claims for Dietary Supplements and Recommend...
Labelling Requirements and Label Claims for Dietary Supplements and Recommend...Lokesh Kothari
 
Nightside clouds and disequilibrium chemistry on the hot Jupiter WASP-43b
Nightside clouds and disequilibrium chemistry on the hot Jupiter WASP-43bNightside clouds and disequilibrium chemistry on the hot Jupiter WASP-43b
Nightside clouds and disequilibrium chemistry on the hot Jupiter WASP-43bSérgio Sacani
 
Zoology 4th semester series (krishna).pdf
Zoology 4th semester series (krishna).pdfZoology 4th semester series (krishna).pdf
Zoology 4th semester series (krishna).pdfSumit Kumar yadav
 
PossibleEoarcheanRecordsoftheGeomagneticFieldPreservedintheIsuaSupracrustalBe...
PossibleEoarcheanRecordsoftheGeomagneticFieldPreservedintheIsuaSupracrustalBe...PossibleEoarcheanRecordsoftheGeomagneticFieldPreservedintheIsuaSupracrustalBe...
PossibleEoarcheanRecordsoftheGeomagneticFieldPreservedintheIsuaSupracrustalBe...Sérgio Sacani
 
Pulmonary drug delivery system M.pharm -2nd sem P'ceutics
Pulmonary drug delivery system M.pharm -2nd sem P'ceuticsPulmonary drug delivery system M.pharm -2nd sem P'ceutics
Pulmonary drug delivery system M.pharm -2nd sem P'ceuticssakshisoni2385
 

Kürzlich hochgeladen (20)

Pests of cotton_Borer_Pests_Binomics_Dr.UPR.pdf
Pests of cotton_Borer_Pests_Binomics_Dr.UPR.pdfPests of cotton_Borer_Pests_Binomics_Dr.UPR.pdf
Pests of cotton_Borer_Pests_Binomics_Dr.UPR.pdf
 
GBSN - Microbiology (Unit 2)
GBSN - Microbiology (Unit 2)GBSN - Microbiology (Unit 2)
GBSN - Microbiology (Unit 2)
 
GBSN - Biochemistry (Unit 1)
GBSN - Biochemistry (Unit 1)GBSN - Biochemistry (Unit 1)
GBSN - Biochemistry (Unit 1)
 
All-domain Anomaly Resolution Office U.S. Department of Defense (U) Case: “Eg...
All-domain Anomaly Resolution Office U.S. Department of Defense (U) Case: “Eg...All-domain Anomaly Resolution Office U.S. Department of Defense (U) Case: “Eg...
All-domain Anomaly Resolution Office U.S. Department of Defense (U) Case: “Eg...
 
Forensic Biology & Its biological significance.pdf
Forensic Biology & Its biological significance.pdfForensic Biology & Its biological significance.pdf
Forensic Biology & Its biological significance.pdf
 
GUIDELINES ON SIMILAR BIOLOGICS Regulatory Requirements for Marketing Authori...
GUIDELINES ON SIMILAR BIOLOGICS Regulatory Requirements for Marketing Authori...GUIDELINES ON SIMILAR BIOLOGICS Regulatory Requirements for Marketing Authori...
GUIDELINES ON SIMILAR BIOLOGICS Regulatory Requirements for Marketing Authori...
 
Formation of low mass protostars and their circumstellar disks
Formation of low mass protostars and their circumstellar disksFormation of low mass protostars and their circumstellar disks
Formation of low mass protostars and their circumstellar disks
 
SAMASTIPUR CALL GIRL 7857803690 LOW PRICE ESCORT SERVICE
SAMASTIPUR CALL GIRL 7857803690  LOW PRICE  ESCORT SERVICESAMASTIPUR CALL GIRL 7857803690  LOW PRICE  ESCORT SERVICE
SAMASTIPUR CALL GIRL 7857803690 LOW PRICE ESCORT SERVICE
 
VIRUSES structure and classification ppt by Dr.Prince C P
VIRUSES structure and classification ppt by Dr.Prince C PVIRUSES structure and classification ppt by Dr.Prince C P
VIRUSES structure and classification ppt by Dr.Prince C P
 
Presentation Vikram Lander by Vedansh Gupta.pptx
Presentation Vikram Lander by Vedansh Gupta.pptxPresentation Vikram Lander by Vedansh Gupta.pptx
Presentation Vikram Lander by Vedansh Gupta.pptx
 
Botany krishna series 2nd semester Only Mcq type questions
Botany krishna series 2nd semester Only Mcq type questionsBotany krishna series 2nd semester Only Mcq type questions
Botany krishna series 2nd semester Only Mcq type questions
 
Hire 💕 9907093804 Hooghly Call Girls Service Call Girls Agency
Hire 💕 9907093804 Hooghly Call Girls Service Call Girls AgencyHire 💕 9907093804 Hooghly Call Girls Service Call Girls Agency
Hire 💕 9907093804 Hooghly Call Girls Service Call Girls Agency
 
Biopesticide (2).pptx .This slides helps to know the different types of biop...
Biopesticide (2).pptx  .This slides helps to know the different types of biop...Biopesticide (2).pptx  .This slides helps to know the different types of biop...
Biopesticide (2).pptx .This slides helps to know the different types of biop...
 
Hubble Asteroid Hunter III. Physical properties of newly found asteroids
Hubble Asteroid Hunter III. Physical properties of newly found asteroidsHubble Asteroid Hunter III. Physical properties of newly found asteroids
Hubble Asteroid Hunter III. Physical properties of newly found asteroids
 
Labelling Requirements and Label Claims for Dietary Supplements and Recommend...
Labelling Requirements and Label Claims for Dietary Supplements and Recommend...Labelling Requirements and Label Claims for Dietary Supplements and Recommend...
Labelling Requirements and Label Claims for Dietary Supplements and Recommend...
 
Nightside clouds and disequilibrium chemistry on the hot Jupiter WASP-43b
Nightside clouds and disequilibrium chemistry on the hot Jupiter WASP-43bNightside clouds and disequilibrium chemistry on the hot Jupiter WASP-43b
Nightside clouds and disequilibrium chemistry on the hot Jupiter WASP-43b
 
CELL -Structural and Functional unit of life.pdf
CELL -Structural and Functional unit of life.pdfCELL -Structural and Functional unit of life.pdf
CELL -Structural and Functional unit of life.pdf
 
Zoology 4th semester series (krishna).pdf
Zoology 4th semester series (krishna).pdfZoology 4th semester series (krishna).pdf
Zoology 4th semester series (krishna).pdf
 
PossibleEoarcheanRecordsoftheGeomagneticFieldPreservedintheIsuaSupracrustalBe...
PossibleEoarcheanRecordsoftheGeomagneticFieldPreservedintheIsuaSupracrustalBe...PossibleEoarcheanRecordsoftheGeomagneticFieldPreservedintheIsuaSupracrustalBe...
PossibleEoarcheanRecordsoftheGeomagneticFieldPreservedintheIsuaSupracrustalBe...
 
Pulmonary drug delivery system M.pharm -2nd sem P'ceutics
Pulmonary drug delivery system M.pharm -2nd sem P'ceuticsPulmonary drug delivery system M.pharm -2nd sem P'ceutics
Pulmonary drug delivery system M.pharm -2nd sem P'ceutics
 

Asymptotic Growth of Functions

  • 1. 1 CMPS 102 Introduction to Analysis of Algorithms Fall 2003 Asymptotic Growth of Functions We introduce several types of asymptotic notation which are used to compare the performance and efficiency of algorithms. As we’ll see, the asymptotic run time of an algorithm gives a simple, and machine independent, characterization of it’s complexity. Definition Let )(ng be a function. The set ))(( ngO is defined as })()(0:,0,0|)({))(( 00 ncgnfnnncnfngO ≤≤≥∀>∃>∃= . In other words, ))(()( ngOnf ∈ if and only if there exist positive constants c, and 0n , such that for all 0nn ≥ , the inequality )()(0 ncgnf ≤≤ is satisfied. We say that )(nf is Big O of )(ng , or that )(ng is an asymptotic upper bound for )(nf . We often abuse notation slightly by writing ))(()( ngOnf = to mean ))(()( ngOnf ∈ . Actually ))(()( ngOnf ∈ is also an abuse of notation. We should really write )(gOf ∈ since what we have defined is a set of functions, not a set of numbers. The notational convention ))(( ngO is useful since it allows us to refer to the set )( 3 nO say, without having to introduce a function symbol for the polynomial 3 n . Observe that if ))(()( ngOnf = then )(nf is asymptotically non-negative, i.e. )(nf is non-negative for all sufficiently large n, and likewise for )(ng . We make the blanket assumption from now on that all functions under discussion are asymptotically non-negative. In practice we will be concerned with integer valued functions of a (positive) integer n ( ++ → ZZ:g ). However, in what follows, it is useful to consider n to be a continuous real variable taking positive values and g to be real valued function ( ++ → RR:g ). Geometrically ))(()( ngOnf = says: )(ncg )(nf 0n
  • 2. 2 Example )30010(10040 2 ++=+ nnOn . Observe that 30010100400 2 ++≤+≤ nnn for all 20≥n , as can be easily verified. Thus we may take 200 =n and 1=c in the definition. 300102 ++ nn 300 10040 +n 100 10 20 Note that in this example, any value of 0n greater than 20 will also work, and likewise any value of c greater than 1 works. In general if there exist positive constants 0n and c such that )()(0 ncgnf ≤≤ for all 0nn ≥ , then infinitely many such constants also exist. In order to prove that ))(()( ngOnf = it is not necessary to find the smallest possible 0n and c making the )()(0 ncgnf ≤≤ true. It is only necessary to show that at least one pair of such constants exist. Generalizing the last example, we will show that )( 2 edncnOban ++=+ for any constants a-e, and in fact ))(()( nqOnp = whenever )(np and )(nq are polynomials with )deg()deg( qp ≤ . Definition Let )(ng be a function and define the set ))(( ngΩ to be })()(0:,0,0|)({))(( 00 nfncgnnncnfng ≤≤≥∀>∃>∃=Ω . We say )(nf is big Omega of )(ng , and that )(ng is an asymptotic lower bound for )(nf . As before we write ))(()( ngnf Ω= to mean ))(()( ngnf Ω∈ . The geometric interpretation is: )(nf )(ncg 0n
  • 3. 3 Lemma ))(()( ngOnf = if and only if ))(()( nfng Ω= . Proof: If ))(()( ngOnf = then there exist positive numbers 1c , 1n such that )()(0 1 ngcnf ≤≤ for all 1nn ≥ . Let 12 /1 cc = and 12 nn = . Then )()(0 2 ngnfc ≤≤ for all 2nn ≥ , proving ))(()( nfng Ω= . The converse is similar and we leave it to the reader. /// Definition Let )(ng be a function and define the set ))(())(())(( ngngOng Ω∩=Θ . Equivalently })()()(0:,0,0,0|)({))(( 210021 ngcnfngcnnnccnfng ≤≤≤≥∀>∃>∃>∃=Θ . We write ))(()( ngnf Θ= and say the )(ng is an asymptotically tight bound for )(nf , or that )(nf and )(ng are asymptotically equivalent. We interpret this geometrically as: )(2 ngc )(nf )(1 ngc 0n Exercise Prove that if c is a positive constant, then ))(()( nfncf Θ= . Exercise Prove that ))(()( ngnf Θ= if and only if ))(()( nfng Θ= . Example Prove that ( )nn Θ=+10 . Proof: According to the definition, we must find positive numbers 021 ,, ncc , such that the inequality ncnnc 21 100 ≤+≤≤ holds for all 0nn ≥ . Pick 11 =c , 22 =c , and 100 =n . Then if 0nn ≥ we have: 010 ≤− and n≤10 ∴ n)11(10 −≤− and n)12(10 −≤ ∴ nc )1(10 2 1−≤− and nc )1(10 2 2 −≤ ∴ 102 1 +≤ nnc and ncn 2 210 ≤+ , ∴ ncnnc 2 2 2 1 10 ≤+≤ , ∴ ncnnc 21 10 ≤+≤ , as required. ///
  • 4. 4 The reader may find our choice of values for the constants 021 ,, ncc in this example somewhat mysterious. Adequate values for these constants can usually be obtained by working backwards algebraically from the inequality to be proved. Notice that in this example there are many valid choices. For instance one checks easily that 2/11 =c , 2/32 =c , and 200 =n work equally well. Exercise Let a, b be real numbers with 0>b . Prove directly from the definition (as above) that )()( bb nan Θ=+ . (In what follows we learn a much easier way to prove this.) Lemma If )()( nhnf ≤ for all sufficiently large n, and if ))(()( ngOnh = , then ))(()( ngOnf = . Proof: The above hypotheses say that there exist positive numbers c and 1n such that )()( ncgnh ≤ for all 1nn ≥ . Also there exists 2n such that )()(0 nhnf ≤≤ for all 2nn ≥ . (Recall )(nf is assumed to be asymptotically non-negative.) Define ),max( 210 nnn = , so that if 0nn ≥ we have both 1nn ≥ and 2nn ≥ . Thus 0nn ≥ implies )()(0 ncgnf ≤≤ , and therefore ))(()( ngOnf = . /// Exercise Prove that if )()()( 21 nhnfnh ≤≤ for all sufficiently large n, where ))(()(1 ngnh Ω= and ))(()(2 ngOnh = , then ))(()( ngnf Θ= . Example Let 1≥k be a fixed integer. Prove that )( 1 1 + = Θ= k n i k ni . Proof: Observe that )( 11 11 ++ == ==⋅=≤ kkk n i k n i k nOnnnni , and )()2/1()2/)(2/()2/(2/)2/( 111 2/2/1 +++ === Ω==≥⋅≥≥≥ kkkkk n ni k n ni k n i k nnnnnnnii . By the result of the preceding exercise, we conclude )( 1 1 + = Θ= k n i k ni . /// When asymptotic notation appears in a formula such as )()2/(2)( nnTnT Θ+= we interpret )(nΘ to stand for some anonymous function in the class )(nΘ . For example )(31243 2323 nnnnn Θ+=+−+ . Here )( 2 nΘ stands for 124 2 +− nn , which belongs to the class )( 2 nΘ . The expression = Θ n i i1 )( can be puzzling. On the surface it stands for )()3()2()1( nΘ++Θ+Θ+Θ , which is meaningless since )constant(Θ consists of all functions which are bounded above by some constant. We interpret )(iΘ in this expression to stand for a single function )(if in the class )(iΘ , evaluated at ni ,,3,2,1= . Exercise Prove that )()( 2 1 ni n i Θ=Θ= . The left hand side stands for a single function )(if summed for ni ,,3,2,1= . By the previous exercise it is sufficient to show that )()()( 211 nhifnh n i ≤≤ = for all sufficiently large n, where )()( 2 1 nnh Ω= and )()( 2 2 nOnh = .
  • 5. 5 Definition })()(0:,0,0|)({))(( 00 ncgnfnnncnfngo <≤≥∀>∃>∀= . We say that )(ng is a strict Asymptotic upper bound for )(nf and write ))(()( ngonf = as before. Lemma ))(()( ngonf = if and only if 0 )( )( lim = ∞→ ng nf n . Proof: Observe that ))(()( ngonf = if and only if c ng nf nnnc <≤≥∀>∃>∀ )( )( 0:,0,0 00 , which is the very definition of the limit statement 0 )( )( lim = ∞→ ng nf n . /// Example )()lg( non = since 0 )lg( lim = ∞→ n n n . (Apply l’Hopitals rule.) Example )( nk bon = for any 0>k and 1>b since 0lim = ∞→ n k n b n . (Apply l’Hopitals rule k times.) In other words, any exponential grows strictly faster than any polynomial. By comparing definitions of ))(( ngo and ))(( ngO one sees immediately that ))(())(( ngOngo ⊆ . Also no function can belong to both ))(( ngo and ))(( ngΩ , as is easily verified (exercise). Thus ∅=Ω∩ ))(())(( ngngo , and therefore ))(())(())(( ngngOngo Θ−⊆ . Definition })()(0:,0,0|)({))(( 00 nfncgnnncnfng <≤≥∀>∃>∀=ω . Here we say that )(ng is a strict asymptotic lower bound for )(nf and write ))(()( ngnf ω= . Exercise Prove that ))(()( ngnf ω= if and only if ∞= ∞→ )( )( lim ng nf n . Exercise Prove ∅=∩ ))(())(( ngOngω , whence ))(())(())(( ngngng Θ−Ω⊆ω . The following picture emerges: ))(( ngO ))(( ngΩ ))(( ngo ))(( ngΘ ))(( ngω
  • 6. 6 Lemma If L ng nf n = ∞→ )( )( lim , where ∞<≤ L0 , then ))(()( ngOnf = . Proof: The definition of the above limit is εε <−≥∀>∃>∀ L ng nf nnn )( )( :,0,0 00 . Thus if we let 1=ε , there exists a positive number 0n such that for all 0nn ≥ : 1 )( )( <− L ng nf ∴ 1 )( )( 1 <−<− L ng nf ∴ 1 )( )( +< L ng nf ∴ )()1()( ngLnf ⋅+< . Now take 1+= Lc in the definition of O , so that ))(()( ngOnf = as claimed. /// Lemma If L ng nf n = ∞→ )( )( lim , where ∞≤< L0 , then ))(()( ngnf Ω= . Proof: The limit statement implies L nf ng n ′= ∞→ )( )( lim , where LL /1=′ and hence ∞<′≤ L0 . By the previous lemma ))(()( nfOng = , and therefore ))(()( ngnf Ω= . /// Exercise Prove that if L ng nf n = ∞→ )( )( lim , where ∞<< L0 , then ))(()( ngnf Θ= . Although ))(( ngo , ))(( ngω , and a certain subset of ))(( ngΘ are characterized by limits, the full sets ))(( ngO , ))(( ngΩ , and ))(( ngΘ have no such characterization as the following examples show. Example A Let nng =)( and nnnf ⋅+= ))sin(1()( . )(2 ng )(nf Clearly ))(()( ngOnf = , but )sin(1 )( )( n ng nf += , whose limit does not exist. This example shows that the containment ))(())(())(( ngngOngo Θ−⊆ is in general strict since ))(()( ngnf Ω≠ (exercise). Therefore ))(()( ngnf Θ≠ , so that ))(())(()( ngngOnf Θ−∈ . But ))(()( ngonf ≠ since the limit does not exist.
  • 7. 7 Example B Let nng =)( and nnnf ⋅+= ))sin(2()( . )(3 ng )(nf )(ng Since nnnn 3))sin(2( ≤⋅+≤ for all 0≥n , we have ))(()( ngnf Θ= , but )sin(2 )( )( n ng nf += whose limit does not exist. Exercise Find functions )(nf and )(ng such that ))(())(()( ngngnf Θ−Ω∈ , but )( )( lim ng nf n ∞→ does not exist (even in the sense of being infinite), so that ))(()( ngnf ω≠ . The preceding limit theorems and counter-examples can be summarized in the following diagram. Here L denotes the limit )( )( lim ng nf L n ∞→ = , if it exists. ))(( ngO ))(( ngΩ ))(( ngΘ ))(( ngo ))(( ngω 0=L ∞<< L0 ∞=L Ex A Ex B In spite of the above counter-examples, the preceding limit theorems are a very useful tool for establishing asymptotic comparisons between functions. For instance recall the earlier exercise to show )()( bb nan Θ=+ for real numbers a, and b with 0>b . The result follows immediately from 111lim )( lim ==+= + ∞→∞→ b b nb b n n a n an , since ∞<<10 .
  • 8. 8 Exercise Use limits to prove the following: a. )()lg( 2 nonn = (here )lg(n denotes the base 2 logarithm of n.) b. )(2 105 nn n ω= . c. If )(nP is a polynomial of degree 0≥k , then )()( k nnP Θ= . d. ))(())(()( nfnfonf Θ=+ . (One can always disregard lower order terms) e. )()(log ε non k = for any 0>k and 0>ε . (Polynomials grow faster than logs.) f. )( n bon =ε for any 0>ε and 1>b . (Exponentials grow faster than polynomials.) There is an analogy between the asymptotic comparison of functions )(nf and )(ng , and the comparison of real numbers x and y. ))(()( ngOnf = ~ yx ≤ ))(()( ngnf Θ= ~ yx = ))(()( ngnf Ω= ~ yx ≥ ))(()( ngonf = ~ yx < ))(()( ngnf ω= ~ yx > Note however that this analogy is not exact since there exist pairs of functions which are not comparable, while any two real numbers are comparable. (See problem 3-2c, p.58.)