SlideShare a Scribd company logo
2
Most read
4
Most read
5
Most read
Asymptotic Analysis
Kinds of analyses
Worst-case: (usually)
• T(n) = maximum time of algorithm on any input of
size n.
Average-case: (sometimes)
• T(n) = expected time of algorithm over all inputs of
size n.
• Need assumption of statistical distribution of inputs.
Best-case:
• Cheat with a slow algorithm that works fast on some
input.
Asymptotic-O-notation
• For a given function , we denote by the set
of functions
• We use O-notation to give an asymptotic upper bound of
a function, to within a constant factor.
• means that there existes some constant c
s.t. is always for large enough n.
)
(n
g ))
(
( n
g
O










0
0
all
for
)
(
)
(
0
s.t.
and
constants
positive
exist
there
:
)
(
))
(
(
n
n
n
cg
n
f
n
c
n
f
n
g
O
))
(
(
)
( n
g
O
n
f 
)
(n
cg

)
(n
f
Ω-Omega notation
• For a given function , we denote by the
set of functions
• We use Ω-notation to give an asymptotic lower bound on
a function, to within a constant factor.
• means that there exists some constant c s.t.
is always for large enough n.
)
(n
g ))
(
( n
g












0
0
all
for
)
(
)
(
0
s.t.
and
constants
positive
exist
there
:
)
(
))
(
(
n
n
n
f
n
cg
n
c
n
f
n
g
))
(
(
)
( n
g
n
f 

)
(n
f )
(n
cg

-Theta notation
• For a given function , we denote by the set
of functions
• A function belongs to the set if there exist
positive constants and such that it can be “sand-
wiched” between and or sufficienly large n.
• means that there exists some constant c1
and c2 s.t. for large enough n.
)
(n
g ))
(
( n
g













0
2
1
0
2
1
all
for
)
(
)
(
)
(
c
0
s.t.
and
,
,
constants
positive
exist
there
:
)
(
))
(
(
n
n
n
g
c
n
f
n
g
n
c
c
n
f
n
g
)
(n
f ))
(
( n
g

1
c 2
c
)
(
1 n
g
c )
(
2 n
g
c
Θ
))
(
(
)
( n
g
n
f 

)
(
)
(
)
( 2
1 n
g
c
n
f
n
g
c 

Asymptotic notation
Graphic examples of and .

 ,
, O
2
2
2
2
1 3
2
1
n
c
n
n
n
c 


2
1
3
2
1
c
n
c 


Example 1.
Show that
We must find c1 and c2 such that
Dividing bothsides by n2 yields
For
)
(
3
2
1
)
( 2
2
n
n
n
n
f 



)
(
3
2
1
,
7 2
2
0 n
n
n
n 



o-notation
• We use o-notation to denote an upper bound
that is not asymptotically tight.
• We formally define as the set
))
(
( n
g
o
















0
0
all
for
)
(
)
(
0
s.t.
0
constants
a
exist
there
0
constant
positive
any
for
:
)
(
))
(
(
n
n
n
cg
n
f
n
c
n
f
n
g
o
0
)
(
)
(
lim 

 n
g
n
f
n
ω-notation
• We use ω-notation to denote an upper bound
that is not asymptotically tight.
• We formally define as the set
))
(
( n
g

















0
0
all
for
)
(
)
(
0
s.t.
0
constants
a
exist
there
0
constant
positive
any
for
:
)
(
))
(
(
n
n
n
f
n
cg
n
c
n
f
n
g




 )
(
)
(
lim n
g
n
f
n
Standard notations and common functions
• Floors and ceilings
    1
1 




 x
x
x
x
x
Standard notations and common functions
• Logarithms:
For all real a>0, b>0, c>0, and n
b
a
a
a
n
a
b
a
ab
b
a
c
c
b
b
n
b
c
c
c
a
b
log
log
log
log
log
log
log
)
(
log
log





Standard notations and common functions
• Logarithms:
b
a
c
a
a
a
a
b
a
c
b
b
b
b
log
1
log
log
)
/
1
(
log
log
log




Standard notations and common functions
• Factorials
For the Stirling approximation:
























n
e
n
n
n
n
1
1
2
!
0

n
)
lg
(
)
!
lg(
)
2
(
!
)
(
!
n
n
n
n
n
o
n
n
n






More Related Content

PDF
Lecture 3(a) Asymptotic-analysis.pdf
PPTX
Asymptotic Notation
PPTX
2_Asymptotic notations.pptx
PPTX
Binary search design and ana algorithm.pptx
PPTX
Asymptotic notation
PDF
DAA_LECT_2.pdf
PDF
Asymptotic notation
PPT
Asymptotic notations
Lecture 3(a) Asymptotic-analysis.pdf
Asymptotic Notation
2_Asymptotic notations.pptx
Binary search design and ana algorithm.pptx
Asymptotic notation
DAA_LECT_2.pdf
Asymptotic notation
Asymptotic notations

Similar to Asymptotic Analysis.ppt (20)

PDF
asymptoticnotations-111102093214-phpapp01 (1).pdf
PPTX
Asymptotic notations
PDF
Asymptotic Growth of Functions
PPTX
Introducction to Algorithm
PPTX
Asymptotic notations ada
PPTX
Asymptotic ssssssssssssssssssssssssssssss.pptx
DOCX
PPTX
Asymptotic notation ada
PPT
asymptotic notations i
PDF
Lecture3(b).pdf
PPTX
Dr hasany 2467_16649_1_lec-2-zabist
PPTX
ASYMPTOTIC NOTATION new topic in daa.pptx
PPTX
Asymptotic notations for desing analysis of algorithm.pptx
PPT
02-asymp.ppt01_Intro.ppt algorithm for preperation stu used
PPT
DSA Asymptotic Notations and Functions.ppt
PPT
ASYMTOTIC NOTATION ON DATA STRUCTURE AND ALGORITHM
PPT
02-asymp.ppt YJTYJTYFHYTYHFHTFTHFHTFTHFTHTHFT
PDF
Data Structures and Algorithms - Lec 02.pdf
PDF
Time complexity (linear search vs binary search)
asymptoticnotations-111102093214-phpapp01 (1).pdf
Asymptotic notations
Asymptotic Growth of Functions
Introducction to Algorithm
Asymptotic notations ada
Asymptotic ssssssssssssssssssssssssssssss.pptx
Asymptotic notation ada
asymptotic notations i
Lecture3(b).pdf
Dr hasany 2467_16649_1_lec-2-zabist
ASYMPTOTIC NOTATION new topic in daa.pptx
Asymptotic notations for desing analysis of algorithm.pptx
02-asymp.ppt01_Intro.ppt algorithm for preperation stu used
DSA Asymptotic Notations and Functions.ppt
ASYMTOTIC NOTATION ON DATA STRUCTURE AND ALGORITHM
02-asymp.ppt YJTYJTYFHYTYHFHTFTHFHTFTHFTHTHFT
Data Structures and Algorithms - Lec 02.pdf
Time complexity (linear search vs binary search)
Ad

Recently uploaded (20)

PDF
The CXO Playbook 2025 – Future-Ready Strategies for C-Suite Leaders Cerebrai...
PPTX
KTU 2019 -S7-MCN 401 MODULE 2-VINAY.pptx
PPTX
additive manufacturing of ss316l using mig welding
PDF
R24 SURVEYING LAB MANUAL for civil enggi
PPTX
web development for engineering and engineering
PDF
Embodied AI: Ushering in the Next Era of Intelligent Systems
PPTX
Infosys Presentation by1.Riyan Bagwan 2.Samadhan Naiknavare 3.Gaurav Shinde 4...
PPT
CRASH COURSE IN ALTERNATIVE PLUMBING CLASS
PPT
Mechanical Engineering MATERIALS Selection
DOCX
573137875-Attendance-Management-System-original
PDF
SM_6th-Sem__Cse_Internet-of-Things.pdf IOT
DOCX
ASol_English-Language-Literature-Set-1-27-02-2023-converted.docx
PDF
Well-logging-methods_new................
PDF
TFEC-4-2020-Design-Guide-for-Timber-Roof-Trusses.pdf
PPTX
Internet of Things (IOT) - A guide to understanding
PDF
Mohammad Mahdi Farshadian CV - Prospective PhD Student 2026
PDF
Model Code of Practice - Construction Work - 21102022 .pdf
PDF
Enhancing Cyber Defense Against Zero-Day Attacks using Ensemble Neural Networks
PPTX
UNIT 4 Total Quality Management .pptx
PDF
Automation-in-Manufacturing-Chapter-Introduction.pdf
The CXO Playbook 2025 – Future-Ready Strategies for C-Suite Leaders Cerebrai...
KTU 2019 -S7-MCN 401 MODULE 2-VINAY.pptx
additive manufacturing of ss316l using mig welding
R24 SURVEYING LAB MANUAL for civil enggi
web development for engineering and engineering
Embodied AI: Ushering in the Next Era of Intelligent Systems
Infosys Presentation by1.Riyan Bagwan 2.Samadhan Naiknavare 3.Gaurav Shinde 4...
CRASH COURSE IN ALTERNATIVE PLUMBING CLASS
Mechanical Engineering MATERIALS Selection
573137875-Attendance-Management-System-original
SM_6th-Sem__Cse_Internet-of-Things.pdf IOT
ASol_English-Language-Literature-Set-1-27-02-2023-converted.docx
Well-logging-methods_new................
TFEC-4-2020-Design-Guide-for-Timber-Roof-Trusses.pdf
Internet of Things (IOT) - A guide to understanding
Mohammad Mahdi Farshadian CV - Prospective PhD Student 2026
Model Code of Practice - Construction Work - 21102022 .pdf
Enhancing Cyber Defense Against Zero-Day Attacks using Ensemble Neural Networks
UNIT 4 Total Quality Management .pptx
Automation-in-Manufacturing-Chapter-Introduction.pdf
Ad

Asymptotic Analysis.ppt

  • 2. Kinds of analyses Worst-case: (usually) • T(n) = maximum time of algorithm on any input of size n. Average-case: (sometimes) • T(n) = expected time of algorithm over all inputs of size n. • Need assumption of statistical distribution of inputs. Best-case: • Cheat with a slow algorithm that works fast on some input.
  • 3. Asymptotic-O-notation • For a given function , we denote by the set of functions • We use O-notation to give an asymptotic upper bound of a function, to within a constant factor. • means that there existes some constant c s.t. is always for large enough n. ) (n g )) ( ( n g O           0 0 all for ) ( ) ( 0 s.t. and constants positive exist there : ) ( )) ( ( n n n cg n f n c n f n g O )) ( ( ) ( n g O n f  ) (n cg  ) (n f
  • 4. Ω-Omega notation • For a given function , we denote by the set of functions • We use Ω-notation to give an asymptotic lower bound on a function, to within a constant factor. • means that there exists some constant c s.t. is always for large enough n. ) (n g )) ( ( n g             0 0 all for ) ( ) ( 0 s.t. and constants positive exist there : ) ( )) ( ( n n n f n cg n c n f n g )) ( ( ) ( n g n f   ) (n f ) (n cg 
  • 5. -Theta notation • For a given function , we denote by the set of functions • A function belongs to the set if there exist positive constants and such that it can be “sand- wiched” between and or sufficienly large n. • means that there exists some constant c1 and c2 s.t. for large enough n. ) (n g )) ( ( n g              0 2 1 0 2 1 all for ) ( ) ( ) ( c 0 s.t. and , , constants positive exist there : ) ( )) ( ( n n n g c n f n g n c c n f n g ) (n f )) ( ( n g  1 c 2 c ) ( 1 n g c ) ( 2 n g c Θ )) ( ( ) ( n g n f   ) ( ) ( ) ( 2 1 n g c n f n g c  
  • 6. Asymptotic notation Graphic examples of and .   , , O
  • 7. 2 2 2 2 1 3 2 1 n c n n n c    2 1 3 2 1 c n c    Example 1. Show that We must find c1 and c2 such that Dividing bothsides by n2 yields For ) ( 3 2 1 ) ( 2 2 n n n n f     ) ( 3 2 1 , 7 2 2 0 n n n n    
  • 8. o-notation • We use o-notation to denote an upper bound that is not asymptotically tight. • We formally define as the set )) ( ( n g o                 0 0 all for ) ( ) ( 0 s.t. 0 constants a exist there 0 constant positive any for : ) ( )) ( ( n n n cg n f n c n f n g o 0 ) ( ) ( lim    n g n f n
  • 9. ω-notation • We use ω-notation to denote an upper bound that is not asymptotically tight. • We formally define as the set )) ( ( n g                  0 0 all for ) ( ) ( 0 s.t. 0 constants a exist there 0 constant positive any for : ) ( )) ( ( n n n f n cg n c n f n g      ) ( ) ( lim n g n f n
  • 10. Standard notations and common functions • Floors and ceilings     1 1       x x x x x
  • 11. Standard notations and common functions • Logarithms: For all real a>0, b>0, c>0, and n b a a a n a b a ab b a c c b b n b c c c a b log log log log log log log ) ( log log     
  • 12. Standard notations and common functions • Logarithms: b a c a a a a b a c b b b b log 1 log log ) / 1 ( log log log    
  • 13. Standard notations and common functions • Factorials For the Stirling approximation:                         n e n n n n 1 1 2 ! 0  n ) lg ( ) ! lg( ) 2 ( ! ) ( ! n n n n n o n n n     