More_O_Notation

More_O_Notation - 1-1More onO()andΘ()NotationLast updated...

Info iconThis preview shows pages 1–19. Sign up to view the full content.

View Full Document Right Arrow Icon

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: 1-1More onO()andΘ()NotationLast updated April 27, 20102-1We have seen the formal definitions of(a)f(n) =O(g(n))and(b)f(n) = Θ(g(n)).Informallyf(n) =O(g(n))means thatf(n)grows no faster thang(n)andf(n) = Θ(g(n))means thatf(n)grows likeg(n).2-2We have seen the formal definitions of(a)f(n) =O(g(n))and(b)f(n) = Θ(g(n)).Informallyf(n) =O(g(n))means thatf(n)grows no faster thang(n)andf(n) = Θ(g(n))means thatf(n)grows likeg(n).We will now see more about using this notation.3-1Functionf(n) =O(g(n)):(read:f(n)isOofg(n))Ifsuch that∀x≥xf(x)≤cg(x).If (i) There is some positivex∈R(ii) There is some positivec∈RRecall The Definition:4-14n28n2+ 2n-3n2/5 +√n-10 lognn(n-3)are allO(n2).SomeExamples4-24n28n2+ 2n-3n2/5 +√n-10 lognn(n-3)are allO(n2).SomeExamplesStatements like these can often be proven usingsimple tools;It is NOT usually necessary to provef(x) =O(g(x))from scratch!5-1Observation 1:If∃xand∃c >such that∀x > x,f(x)≤cThenf(x) =O(1)5-2Observation 1:If∃xand∃c >such that∀x > x,f(x)≤cThenf(x) =O(1)This comes directly from definition ofO(1)5-3Observation 1:If∃xand∃c >such that∀x > x,f(x)≤cThenf(x) =O(1)This comes directly from definition ofO(1)Examples:sin(x) =O(1)2 +1x=O(1)6-1Observation 2:“Constants don’t matter”6-2Observation 2:“Constants don’t matter”Iff(x) =O(g(x))then∀c >,f(x) =O(cg(x)))6-3Observation 2:“Constants don’t matter”Iff(x) =O(g(x))then∀c >,f(x) =O(cg(x)))Proof:f(x) =O(g(x))means that∃x,csuch that∀x > x,f(x)≤cg(x)).But then,∀x > x,f(x)≤cccg(x)),sof(x) =O(cg(x))).6-4Observation 2:“Constants don’t matter”Iff(x) =O(g(x))then∀c >,f(x) =O(cg(x)))Proof:f(x) =O(g(x))means that∃x,csuch that∀x > x,f(x)≤cg(x)).But then,∀x > x,f(x)≤cccg(x)),sof(x) =O(cg(x))).Examples:Iff(x) =O(12n2)thenf(x) =O(n2).Iff(x) =O(5)thenf(x) =O(1).7-1Observation 3:Iff1(x) =O(g1(x))andf2(x) =O(g2(x))thenf1(x) +f2(x) =O(g1(x) +g2(x))7-2Observation 3:Iff1(x) =O(g1(x))andf2(x) =O(g2(x))thenf1(x) +f2(x) =O(g1(x) +g2(x))Proof:∀x≥x1f1(x)≤c1g1(x).By definition, there existx1,c1,x2,c2, such that∀x≥x2f2(x)≤c2g2(x).7-3Observation 3:Iff1(x) =O(g1(x))andf2(x) =O(g2(x))thenf1(x) +f2(x) =O(g1(x) +g2(x))Proof:∀x≥x1f1(x)≤c1g1(x).By definition, there existx1,c1,x2,c2, such that∀x≥x2f2(x)≤c2g2(x).Lettingc3= max{c1,c2}andx3= max{x1,x2}gives∀x≥x3f1(x) +f2(x)≤c3(g1(x) +g2(x)).8-1Observation 3:Iff1(x) =O(g1(x))andf2(x) =O(g2(x))thenf1(x) +f2(x) =O(g1(x) +g2(x))Example:8-2Observation 3:Iff1(x) =O(g1(x))andf2(x) =O(g2(x))thenf1(x) +f2(x) =O(g1(x) +g2(x))Example:f1(x) =x2+ 3xf1(x) =O(x2)....
View Full Document

Page1 / 53

More_O_Notation - 1-1More onO()andΘ()NotationLast updated...

This preview shows document pages 1 - 19. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online