SlideShare a Scribd company logo
1 of 19
Asymptotic Analysis
CLRS, Sections 3.1 – 3.2
Asymptotic Complexity
Running time of an algorithm as a function of
input size n, for large n.
Expressed using only the highest-order
term in the expression for the exact running
time.
Describes behavior of function in the limit.
Written using Asymptotic Notation.
CS 321 - Data Structures 2
Asymptotic Notation
 Q, O, W, o, w
Defined for functions over the natural numbers.
– Ex: f(n) = Q(n2).
• Describes how f(n) grows in comparison to n2.
Defines a set of functions; in practice used to
compare growth rate of two functions.
The notations describe the relationship between
the defining function and a defined set of
functions.
CS 321 - Data Structures 3
O-notation
O(g(n)) = {f(n) :
 positive constants c and n0,
such that n  n0,we have 0 
f(n)  cg(n) }
For function g(n), we define
O(g(n)), big-O of n, as the set:
g(n) is an asymptotic upper bound for f(n).
Intuitively: Set of all functions whose rate of
growth is the same as or lower than that of g(n).
f(n) = Q(g(n))  f(n) = O(g(n))
Q(g(n))  O(g(n))
CS 321 - Data Structures 4
W -notation
g(n) is an asymptotic lower bound for f(n).
Intuitively: Set of all functions whose rate of
growth is the same as or higher than that of g(n).
f(n) = Q(g(n))  f(n) = W(g(n))
Q(g(n))  W(g(n))
W(g(n)) = {f(n) :
 positive constants c and n0,
such that n  n0,
we have 0  cg(n)  f(n)}
For function g(n), we define
W(g(n)), big-Omega of n, as the set:
CS 321 - Data Structures 5
Q-notation
Q(g(n)) = {f(n) :
 positive constants c1, c2, and n0,
such that n  n0, we have 0 
c1g(n)  f(n)  c2g(n)}
For function g(n), we define
Q(g(n)), big-Theta of n, as the set:
g(n) is an asymptotically tight bound for f(n).
Intuitively: Set of all functions that
have the same rate of growth as g(n).
CS 321 - Data Structures 6
Relationship Between Q, O, W
CS 321 - Data Structures 7
Relationship Between Q, W, O
Q(g(n)) = O(g(n))  W(g(n))
In practice, asymptotically tight bounds are
obtained from asymptotic upper and lower
bounds.
Theorem : For any two functions g(n) and f(n),
f(n) = Q(g(n)) iff
f(n) = O(g(n)) and f(n) = W(g(n)).
CS 321 - Data Structures 8
o-notation
g(n) is an upper bound for f(n)that is not
asymptotically tight.
o(g(n)) = {f(n):  c > 0,  n0 > 0 such
that  n  n0, we have 0  f(n) < cg(n)}.
For a given function g(n), the set little-o:
Intuitively: Set of all functions whose rate of
growth is lower than that of g(n).
CS 321 - Data Structures 9
w(g(n)) = {f(n):  c > 0,  n0 > 0 such
that  n  n0, we have 0  cg(n) < f(n)}.
w -notation
g(n) is a lower bound for f(n) that is not
asymptotically tight.
For a given function g(n), the set little-omega:
Intuitively: Set of all functions whose rate of
growth is higher than that of g(n).
CS 321 - Data Structures 10
Comparison of Functions
f  g ~ a  b
f (n) = O(g(n)) ~ a  b
f (n) = W(g(n)) ~ a  b
f (n) = Q(g(n)) ~ a = b
f (n) = o(g(n)) ~ a < b
f (n) = w(g(n)) ~ a > b
CS 321 - Data Structures 11
Limit Definitions of Asymptotic
Notations
o-notation (little-o):
– f(n) becomes insignificant relative to g(n) as n
approaches infinity:
lim [f(n) / g(n)] = 0
n
w -notation (little-omega):
– f(n) becomes arbitrarily large relative to g(n) as
n approaches infinity:
lim [f(n) / g(n)] = 
n
CS 321 - Data Structures 12
Limit Definitions of Asymptotic
Notations
Q-notation (Big-theta):
– f(n) relative to g(n)equals a constant, c, which is
greater than 0 and less than infinity as n approaches
infinity:
0 < lim [f(n) / g(n)] < 
n
CS 321 - Data Structures 13
Limit Definitions of Asymptotic
Notations
O-notation (Big-o):
– f(n)  O(g(n))  f(n)  Q(g(n))and f(n)  o(g(n))
– f(n) relative to g(n)equals some value less than infinity as n
approaches infinity:
lim [f(n) / g(n)] < 
n
W -notation (Big-omega):
– f(n)  W(g(n))  f(n)  Q(g(n))and f(n)  w(g(n))
– f(n) relative to g(n)equals some value greater than 0 as n
approaches infinity:
0 < lim [f(n) / g(n)]
n
CS 321 - Data Structures 14
Examples
Use limit definitions to prove:
– 10n - 3n  O(n2)
– 3n4  W(n3)
– n2/2 - 3n  Q(n2)
– 22n Q(2n)
CS 321 - Data Structures 15
Examples
Use limit definitions to prove:
– 10n - 3n  O(n2) – Yes!
lim [ 10n - 3n / n2 ] = 0
n
– 3n4  W(n3) – Yes!
lim [ 3n4 / n3 ] = 
n
– n2/2 - 3n  Q(n2) – Yes!
lim [ n2/2 - 3n / n2 ] = 1/2
n
– 22n Q(2n) – No!
lim [ 22n / 2n ] = 
n
CS 321 - Data Structures 16
Why Do We Care?
CS 321 - Data Structures 17
T(n)
n n n log n n2
n3
n4
n10
2n
10 .01ms .03ms .1ms 1ms 10ms 10s 1ms
20 .02ms .09ms .4ms 8ms 160ms 2.84h 1ms
30 .03ms .15ms .9ms 27ms 810ms 6.83d 1s
40 .04ms .21ms 1.6ms 64ms 2.56ms 121d 18m
50 .05ms .28ms 2.5ms 125ms 6.25ms 3.1y 13d
100 .1ms .66ms 10ms 1ms 100ms 3171y 4´1013
y
103
1ms 9.96ms 1ms 1s 16.67m 3.17´1013
y 32´10283
y
104
10ms 130ms 100ms 16.67m 115.7d 3.17´1023
y
105
100ms 1.66ms 10s 11.57d 3171y 3.17´1033
y
106
1ms 19.92ms 16.67m 31.71y 3.17´107
y 3.17´1043
y
Complexity and Tractability
Assuming the microprocessor performs 1 billion ops/s.
CS 321 - Data Structures 18
CS 321 - Data Structures 19

More Related Content

Similar to 2-AnalysisOfAlgs.ppt

Lecture 3(a) Asymptotic-analysis.pdf
Lecture 3(a) Asymptotic-analysis.pdfLecture 3(a) Asymptotic-analysis.pdf
Lecture 3(a) Asymptotic-analysis.pdfShaistaRiaz4
 
Lecture 2 data structures and algorithms
Lecture 2 data structures and algorithmsLecture 2 data structures and algorithms
Lecture 2 data structures and algorithmsAakash deep Singhal
 
02 asymptotic notations
02 asymptotic notations02 asymptotic notations
02 asymptotic notationsTarikuDabala1
 
Asymptotic notation
Asymptotic notationAsymptotic notation
Asymptotic notationsajinis3
 
Asymptotic Notation and Complexity
Asymptotic Notation and ComplexityAsymptotic Notation and Complexity
Asymptotic Notation and ComplexityRajandeep Gill
 
DESIGN AND ANALYSIS OF ALGORITHMS
DESIGN AND ANALYSIS OF ALGORITHMSDESIGN AND ANALYSIS OF ALGORITHMS
DESIGN AND ANALYSIS OF ALGORITHMSGayathri Gaayu
 
Dr hasany 2467_16649_1_lec-2-zabist
Dr hasany 2467_16649_1_lec-2-zabistDr hasany 2467_16649_1_lec-2-zabist
Dr hasany 2467_16649_1_lec-2-zabistGatewayggg Testeru
 
Asymptotic notations
Asymptotic notationsAsymptotic notations
Asymptotic notationsEhtisham Ali
 
Asymptotic notation ada
Asymptotic notation adaAsymptotic notation ada
Asymptotic notation adaravinlaheri2
 
1_Asymptotic_Notation_pptx.pptx
1_Asymptotic_Notation_pptx.pptx1_Asymptotic_Notation_pptx.pptx
1_Asymptotic_Notation_pptx.pptxpallavidhade2
 
Skiena algorithm 2007 lecture02 asymptotic notation
Skiena algorithm 2007 lecture02 asymptotic notationSkiena algorithm 2007 lecture02 asymptotic notation
Skiena algorithm 2007 lecture02 asymptotic notationzukun
 
CMSC 56 | Lecture 8: Growth of Functions
CMSC 56 | Lecture 8: Growth of FunctionsCMSC 56 | Lecture 8: Growth of Functions
CMSC 56 | Lecture 8: Growth of Functionsallyn joy calcaben
 
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
 
Clase3 Notacion
Clase3 NotacionClase3 Notacion
Clase3 Notacionluzenith_g
 

Similar to 2-AnalysisOfAlgs.ppt (20)

Lecture3(b).pdf
Lecture3(b).pdfLecture3(b).pdf
Lecture3(b).pdf
 
Lecture 3(a) Asymptotic-analysis.pdf
Lecture 3(a) Asymptotic-analysis.pdfLecture 3(a) Asymptotic-analysis.pdf
Lecture 3(a) Asymptotic-analysis.pdf
 
Lecture 2 data structures and algorithms
Lecture 2 data structures and algorithmsLecture 2 data structures and algorithms
Lecture 2 data structures and algorithms
 
02 asymptotic notations
02 asymptotic notations02 asymptotic notations
02 asymptotic notations
 
Asymptotic notation
Asymptotic notationAsymptotic notation
Asymptotic notation
 
Asymptotic Notation and Complexity
Asymptotic Notation and ComplexityAsymptotic Notation and Complexity
Asymptotic Notation and Complexity
 
1.algorithms
1.algorithms1.algorithms
1.algorithms
 
DESIGN AND ANALYSIS OF ALGORITHMS
DESIGN AND ANALYSIS OF ALGORITHMSDESIGN AND ANALYSIS OF ALGORITHMS
DESIGN AND ANALYSIS OF ALGORITHMS
 
Dr hasany 2467_16649_1_lec-2-zabist
Dr hasany 2467_16649_1_lec-2-zabistDr hasany 2467_16649_1_lec-2-zabist
Dr hasany 2467_16649_1_lec-2-zabist
 
Asymptotic notations
Asymptotic notationsAsymptotic notations
Asymptotic notations
 
Asymptotic notation ada
Asymptotic notation adaAsymptotic notation ada
Asymptotic notation ada
 
1_Asymptotic_Notation_pptx.pptx
1_Asymptotic_Notation_pptx.pptx1_Asymptotic_Notation_pptx.pptx
1_Asymptotic_Notation_pptx.pptx
 
Skiena algorithm 2007 lecture02 asymptotic notation
Skiena algorithm 2007 lecture02 asymptotic notationSkiena algorithm 2007 lecture02 asymptotic notation
Skiena algorithm 2007 lecture02 asymptotic notation
 
CMSC 56 | Lecture 8: Growth of Functions
CMSC 56 | Lecture 8: Growth of FunctionsCMSC 56 | Lecture 8: Growth of Functions
CMSC 56 | Lecture 8: Growth of Functions
 
big_oh
big_ohbig_oh
big_oh
 
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
 
Asymptotic Notation
Asymptotic NotationAsymptotic Notation
Asymptotic Notation
 
Clase3 Notacion
Clase3 NotacionClase3 Notacion
Clase3 Notacion
 
Time complexity
Time complexityTime complexity
Time complexity
 
Algorithm.ppt
Algorithm.pptAlgorithm.ppt
Algorithm.ppt
 

Recently uploaded

Contemporary philippine arts from the regions_PPT_Module_12 [Autosaved] (1).pptx
Contemporary philippine arts from the regions_PPT_Module_12 [Autosaved] (1).pptxContemporary philippine arts from the regions_PPT_Module_12 [Autosaved] (1).pptx
Contemporary philippine arts from the regions_PPT_Module_12 [Autosaved] (1).pptxRoyAbrique
 
Grant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy ConsultingGrant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy ConsultingTechSoup
 
Concept of Vouching. B.Com(Hons) /B.Compdf
Concept of Vouching. B.Com(Hons) /B.CompdfConcept of Vouching. B.Com(Hons) /B.Compdf
Concept of Vouching. B.Com(Hons) /B.CompdfUmakantAnnand
 
PSYCHIATRIC History collection FORMAT.pptx
PSYCHIATRIC   History collection FORMAT.pptxPSYCHIATRIC   History collection FORMAT.pptx
PSYCHIATRIC History collection FORMAT.pptxPoojaSen20
 
Presiding Officer Training module 2024 lok sabha elections
Presiding Officer Training module 2024 lok sabha electionsPresiding Officer Training module 2024 lok sabha elections
Presiding Officer Training module 2024 lok sabha electionsanshu789521
 
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...EduSkills OECD
 
Arihant handbook biology for class 11 .pdf
Arihant handbook biology for class 11 .pdfArihant handbook biology for class 11 .pdf
Arihant handbook biology for class 11 .pdfchloefrazer622
 
Sanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdfSanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdfsanyamsingh5019
 
Q4-W6-Restating Informational Text Grade 3
Q4-W6-Restating Informational Text Grade 3Q4-W6-Restating Informational Text Grade 3
Q4-W6-Restating Informational Text Grade 3JemimahLaneBuaron
 
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...Marc Dusseiller Dusjagr
 
Accessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impactAccessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impactdawncurless
 
Alper Gobel In Media Res Media Component
Alper Gobel In Media Res Media ComponentAlper Gobel In Media Res Media Component
Alper Gobel In Media Res Media ComponentInMediaRes1
 
URLs and Routing in the Odoo 17 Website App
URLs and Routing in the Odoo 17 Website AppURLs and Routing in the Odoo 17 Website App
URLs and Routing in the Odoo 17 Website AppCeline George
 
Organic Name Reactions for the students and aspirants of Chemistry12th.pptx
Organic Name Reactions  for the students and aspirants of Chemistry12th.pptxOrganic Name Reactions  for the students and aspirants of Chemistry12th.pptx
Organic Name Reactions for the students and aspirants of Chemistry12th.pptxVS Mahajan Coaching Centre
 
A Critique of the Proposed National Education Policy Reform
A Critique of the Proposed National Education Policy ReformA Critique of the Proposed National Education Policy Reform
A Critique of the Proposed National Education Policy ReformChameera Dedduwage
 
CARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptxCARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptxGaneshChakor2
 
Introduction to ArtificiaI Intelligence in Higher Education
Introduction to ArtificiaI Intelligence in Higher EducationIntroduction to ArtificiaI Intelligence in Higher Education
Introduction to ArtificiaI Intelligence in Higher Educationpboyjonauth
 
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdfBASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdfSoniaTolstoy
 
Mastering the Unannounced Regulatory Inspection
Mastering the Unannounced Regulatory InspectionMastering the Unannounced Regulatory Inspection
Mastering the Unannounced Regulatory InspectionSafetyChain Software
 

Recently uploaded (20)

Contemporary philippine arts from the regions_PPT_Module_12 [Autosaved] (1).pptx
Contemporary philippine arts from the regions_PPT_Module_12 [Autosaved] (1).pptxContemporary philippine arts from the regions_PPT_Module_12 [Autosaved] (1).pptx
Contemporary philippine arts from the regions_PPT_Module_12 [Autosaved] (1).pptx
 
Grant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy ConsultingGrant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy Consulting
 
Concept of Vouching. B.Com(Hons) /B.Compdf
Concept of Vouching. B.Com(Hons) /B.CompdfConcept of Vouching. B.Com(Hons) /B.Compdf
Concept of Vouching. B.Com(Hons) /B.Compdf
 
PSYCHIATRIC History collection FORMAT.pptx
PSYCHIATRIC   History collection FORMAT.pptxPSYCHIATRIC   History collection FORMAT.pptx
PSYCHIATRIC History collection FORMAT.pptx
 
Presiding Officer Training module 2024 lok sabha elections
Presiding Officer Training module 2024 lok sabha electionsPresiding Officer Training module 2024 lok sabha elections
Presiding Officer Training module 2024 lok sabha elections
 
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
 
Arihant handbook biology for class 11 .pdf
Arihant handbook biology for class 11 .pdfArihant handbook biology for class 11 .pdf
Arihant handbook biology for class 11 .pdf
 
Sanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdfSanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdf
 
Q4-W6-Restating Informational Text Grade 3
Q4-W6-Restating Informational Text Grade 3Q4-W6-Restating Informational Text Grade 3
Q4-W6-Restating Informational Text Grade 3
 
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
 
Accessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impactAccessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impact
 
Alper Gobel In Media Res Media Component
Alper Gobel In Media Res Media ComponentAlper Gobel In Media Res Media Component
Alper Gobel In Media Res Media Component
 
URLs and Routing in the Odoo 17 Website App
URLs and Routing in the Odoo 17 Website AppURLs and Routing in the Odoo 17 Website App
URLs and Routing in the Odoo 17 Website App
 
Organic Name Reactions for the students and aspirants of Chemistry12th.pptx
Organic Name Reactions  for the students and aspirants of Chemistry12th.pptxOrganic Name Reactions  for the students and aspirants of Chemistry12th.pptx
Organic Name Reactions for the students and aspirants of Chemistry12th.pptx
 
A Critique of the Proposed National Education Policy Reform
A Critique of the Proposed National Education Policy ReformA Critique of the Proposed National Education Policy Reform
A Critique of the Proposed National Education Policy Reform
 
CARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptxCARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptx
 
Introduction to ArtificiaI Intelligence in Higher Education
Introduction to ArtificiaI Intelligence in Higher EducationIntroduction to ArtificiaI Intelligence in Higher Education
Introduction to ArtificiaI Intelligence in Higher Education
 
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdfBASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdf
 
Código Creativo y Arte de Software | Unidad 1
Código Creativo y Arte de Software | Unidad 1Código Creativo y Arte de Software | Unidad 1
Código Creativo y Arte de Software | Unidad 1
 
Mastering the Unannounced Regulatory Inspection
Mastering the Unannounced Regulatory InspectionMastering the Unannounced Regulatory Inspection
Mastering the Unannounced Regulatory Inspection
 

2-AnalysisOfAlgs.ppt

  • 2. Asymptotic Complexity Running time of an algorithm as a function of input size n, for large n. Expressed using only the highest-order term in the expression for the exact running time. Describes behavior of function in the limit. Written using Asymptotic Notation. CS 321 - Data Structures 2
  • 3. Asymptotic Notation  Q, O, W, o, w Defined for functions over the natural numbers. – Ex: f(n) = Q(n2). • Describes how f(n) grows in comparison to n2. Defines a set of functions; in practice used to compare growth rate of two functions. The notations describe the relationship between the defining function and a defined set of functions. CS 321 - Data Structures 3
  • 4. O-notation O(g(n)) = {f(n) :  positive constants c and n0, such that n  n0,we have 0  f(n)  cg(n) } For function g(n), we define O(g(n)), big-O of n, as the set: g(n) is an asymptotic upper bound for f(n). Intuitively: Set of all functions whose rate of growth is the same as or lower than that of g(n). f(n) = Q(g(n))  f(n) = O(g(n)) Q(g(n))  O(g(n)) CS 321 - Data Structures 4
  • 5. W -notation g(n) is an asymptotic lower bound for f(n). Intuitively: Set of all functions whose rate of growth is the same as or higher than that of g(n). f(n) = Q(g(n))  f(n) = W(g(n)) Q(g(n))  W(g(n)) W(g(n)) = {f(n) :  positive constants c and n0, such that n  n0, we have 0  cg(n)  f(n)} For function g(n), we define W(g(n)), big-Omega of n, as the set: CS 321 - Data Structures 5
  • 6. Q-notation Q(g(n)) = {f(n) :  positive constants c1, c2, and n0, such that n  n0, we have 0  c1g(n)  f(n)  c2g(n)} For function g(n), we define Q(g(n)), big-Theta of n, as the set: g(n) is an asymptotically tight bound for f(n). Intuitively: Set of all functions that have the same rate of growth as g(n). CS 321 - Data Structures 6
  • 7. Relationship Between Q, O, W CS 321 - Data Structures 7
  • 8. Relationship Between Q, W, O Q(g(n)) = O(g(n))  W(g(n)) In practice, asymptotically tight bounds are obtained from asymptotic upper and lower bounds. Theorem : For any two functions g(n) and f(n), f(n) = Q(g(n)) iff f(n) = O(g(n)) and f(n) = W(g(n)). CS 321 - Data Structures 8
  • 9. o-notation g(n) is an upper bound for f(n)that is not asymptotically tight. o(g(n)) = {f(n):  c > 0,  n0 > 0 such that  n  n0, we have 0  f(n) < cg(n)}. For a given function g(n), the set little-o: Intuitively: Set of all functions whose rate of growth is lower than that of g(n). CS 321 - Data Structures 9
  • 10. w(g(n)) = {f(n):  c > 0,  n0 > 0 such that  n  n0, we have 0  cg(n) < f(n)}. w -notation g(n) is a lower bound for f(n) that is not asymptotically tight. For a given function g(n), the set little-omega: Intuitively: Set of all functions whose rate of growth is higher than that of g(n). CS 321 - Data Structures 10
  • 11. Comparison of Functions f  g ~ a  b f (n) = O(g(n)) ~ a  b f (n) = W(g(n)) ~ a  b f (n) = Q(g(n)) ~ a = b f (n) = o(g(n)) ~ a < b f (n) = w(g(n)) ~ a > b CS 321 - Data Structures 11
  • 12. Limit Definitions of Asymptotic Notations o-notation (little-o): – f(n) becomes insignificant relative to g(n) as n approaches infinity: lim [f(n) / g(n)] = 0 n w -notation (little-omega): – f(n) becomes arbitrarily large relative to g(n) as n approaches infinity: lim [f(n) / g(n)] =  n CS 321 - Data Structures 12
  • 13. Limit Definitions of Asymptotic Notations Q-notation (Big-theta): – f(n) relative to g(n)equals a constant, c, which is greater than 0 and less than infinity as n approaches infinity: 0 < lim [f(n) / g(n)] <  n CS 321 - Data Structures 13
  • 14. Limit Definitions of Asymptotic Notations O-notation (Big-o): – f(n)  O(g(n))  f(n)  Q(g(n))and f(n)  o(g(n)) – f(n) relative to g(n)equals some value less than infinity as n approaches infinity: lim [f(n) / g(n)] <  n W -notation (Big-omega): – f(n)  W(g(n))  f(n)  Q(g(n))and f(n)  w(g(n)) – f(n) relative to g(n)equals some value greater than 0 as n approaches infinity: 0 < lim [f(n) / g(n)] n CS 321 - Data Structures 14
  • 15. Examples Use limit definitions to prove: – 10n - 3n  O(n2) – 3n4  W(n3) – n2/2 - 3n  Q(n2) – 22n Q(2n) CS 321 - Data Structures 15
  • 16. Examples Use limit definitions to prove: – 10n - 3n  O(n2) – Yes! lim [ 10n - 3n / n2 ] = 0 n – 3n4  W(n3) – Yes! lim [ 3n4 / n3 ] =  n – n2/2 - 3n  Q(n2) – Yes! lim [ n2/2 - 3n / n2 ] = 1/2 n – 22n Q(2n) – No! lim [ 22n / 2n ] =  n CS 321 - Data Structures 16
  • 17. Why Do We Care? CS 321 - Data Structures 17
  • 18. T(n) n n n log n n2 n3 n4 n10 2n 10 .01ms .03ms .1ms 1ms 10ms 10s 1ms 20 .02ms .09ms .4ms 8ms 160ms 2.84h 1ms 30 .03ms .15ms .9ms 27ms 810ms 6.83d 1s 40 .04ms .21ms 1.6ms 64ms 2.56ms 121d 18m 50 .05ms .28ms 2.5ms 125ms 6.25ms 3.1y 13d 100 .1ms .66ms 10ms 1ms 100ms 3171y 4´1013 y 103 1ms 9.96ms 1ms 1s 16.67m 3.17´1013 y 32´10283 y 104 10ms 130ms 100ms 16.67m 115.7d 3.17´1023 y 105 100ms 1.66ms 10s 11.57d 3171y 3.17´1033 y 106 1ms 19.92ms 16.67m 31.71y 3.17´107 y 3.17´1043 y Complexity and Tractability Assuming the microprocessor performs 1 billion ops/s. CS 321 - Data Structures 18
  • 19. CS 321 - Data Structures 19