ASYMPTOTIC NOTATION.ppt - Asymptotic Asymptotic Notation,...

This preview shows page 1 - 10 out of 43 pages.

The preview shows page 8 - 10 out of 43 pages.
January 8, 2022Comp 122, Spring 2004Asymptotic Notation,Review of Functions &SummationsAsymptotic Notation,Review of Functions &SummationsHome work
ymp - 2For(i=1;i<n;i++)//nFor(j=i+5;j<10;j++)// i=nPrintf(“%d”,j);When i=1j=12nd loop run in n timesi=2j=2n-1 timesi=3j=3n-2 times....i=n-11 timesComp 122
ymp - 3Assumptions about ASYMPTOTICNOTATION or order of growth(O,o,wetc )1.Domain should be a whole no2.Lower order terms and constants are negletctedas compare with higherorder terms.E.i:f(n)=3n^3+200n^2+500.. g(n)=n^33. It isused for monotonically increasing anddecreasing functions. Not used for oscillatingfunctions (sinQ,)4.O(n)-> set of functionsComp 122
ymp - 45.O(constant)=O(5000000)=O(1)F(n)=550000cO(1)6. f(n)=O(n^2)or f(n) (=) belongs to O(n^2)Comp 122
ymp - 5Comp 122Asymptotic ComplexityRunning time of an algorithm as a function ofinput sizenfor largen.Expressed using only thehighest-order terminthe expression for the exact running time.Instead of exact running time, say(n2).Describes behavior of function in the limit.Written usingAsymptotic Notation.
ymp - 6Comp 122Asymptotic Notation,O,,o,Defined for functions over the natural numbers.Ex:f(n)=(n2).Describes howf(n) grows in comparison ton2.Define asetof functions; in practice used to comparetwo function sizes.The notations describe different rate-of-growthrelations between the defining function and the definedset of functions.osmallo notation (strictly upper bound)( it is usedfor worse case, generally )
ymp - 7Comp 122-notation(g(n)) ={f(n) :positive constantsc1,c2, andn0,such thatnn0,we have0c1g(n)f(n)c2g(n)}For functiong(n), we define(g(n)),big-Theta ofn, as the set:g(n) is anasymptotically tight boundforf(n).Intuitively: Set of all functions thathave the samerate of growthasg(n).
ymp - 8Comp 122-notation(g(n)) ={f(n) :positive constantsc1,c2, andn0,such thatnn0,we have0c1g(n)f(n)c2g(n)}For functiong(n), we define(g(n)),big-Theta ofn, as the set:Technically,f(n)(g(n)).Older usage,f(n) =(g(n)).I’ll accept either…f(n) andg(n) are nonnegative, for largen.
ymp - 9Comp 122Example10n2-3n =(n2)What constants forn0,c1, andc2will work?Makec1a little smaller than the leadingcoefficient, andc2a little bigger.

Upload your study docs or become a

Course Hero member to access this document

Upload your study docs or become a

Course Hero member to access this document

End of preview. Want to read all 43 pages?

Upload your study docs or become a

Course Hero member to access this document

Term
Fall
Professor
NoProfessor
Tags
Bubble Sort, Big O notation, Analysis of algorithms, Asymptotic analysis, YMP

  • Left Quote Icon

    Student Picture

  • Left Quote Icon

    Student Picture

  • Left Quote Icon

    Student Picture