Asymptotic
Analysis
Big-‐Oh: Definition
Design and Analysis
of Algorithms I
Nextcore AI Gopal
Shangari
Nextcore AI Gopal
Shangari
Asymptotic
Analysis
Big-‐Oh: Basic
Examples
Design and Analysis
of Algorithms I
Example #1
Claim : if
Proof : Choose
Need to show that
We have, for every
then
and
Nextcore AI Gopal
Shangari
Example #2
Claim : for every
is not
Proof : by contradiction. Suppose
Then there exist constants
But then [cancelling
such that
from both sides]:
Which is clearly False [contradict i o n ]
Nextcore AI Gopal
Shangari
Asymptotic
Analysis
Big Oh: Relatives
(Omega & Theta)
Design and Analysis
of Algorithms I
Nextcore AI Gopal Shangari
OMEGA NOTATION
Definition :
If and only if there exist
constants
such that
Picture
Nextcore AI Gopal Shangari
Theta Notation
Defini4on :
if and only if
and
Equivalent : there exist constants
such that
Nextcore AI Gopal Shangari
WHICH IS TRUE? CHECK ALL
Let
LIMLE8OHNOTA4ON
Defini4on :
if and only if for all
constants c>0, there exists a constant
such that
Exercise :
Where Does Notation Come From?
•
Asymptotic
Analysis
Additional
Examples
Design and Analysis
of Algorithms I
EXAMPLE #1
Claim :
Proof : need to pick constants
Note :
So if we choose
such that
then (*) holds.
Q.E.D
Nextcore AI Gopal Shangari
EXAMPLE #2
Claim :
Proof : by contradiction. If
constants
such that
But then [cancelling
then there exist
]
Which is certainly false.
Q.E.D
Nextcore AI Gopal Shangari
Example #3
Claim : for every pair of (posi( veti func( ons f(nti,
g(nti,
Nextcore AI Gopal
Shangari
EXAMPLE #3 (CON( NUEDTI
Proof :
For every n, we have
And
Thus
Q.E.D
Nextcore AI Gopal
Shangari