21 - 03/03/09 14:57:33 CS 61B: Lecture 21 Wednesday, March...

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

View Full Document Right Arrow Icon
03/03/09 14:57:33 1 21 CS 61B: Lecture 21 Wednesday, March 11, 2009 ASYMPTOTIC ANALYSIS (continued): More Formalism ================================================ |-----------------------------------------------------------------------------| | Omega(f(n)) is the set of all functions T(n) that satisfy: | | | | There exist positive constants d and N such that, for all n >= N, | | T(n) >= d f(n) | |-----------------------------------------------------------------------------| ^^^^^^^^^^ Compare with the definition of Big-Oh: T(n) <= c f(n). ^^^^^^^^^^^ Omega is the reverse of Big-Oh. If T(n) is in O(f(n)), f(n) is in Omega(T(n)). 2n is in Omega(n) BECAUSE n is in O(2n). n^2 is in Omega(n) BECAUSE n is in O(n^2). n^2 is in Omega(3 n^2 + n log n) BECAUSE 3 n^2 + n log n is in O(n^2). Omega gives us a LOWER BOUND on a function, just as Big-Oh gives us an UPPER BOUND. Big-Oh says, "Your algorithm is at least this good." Omega says, "Your algorithm is at least this bad." If we have both--say, T(n) is in O(f(n)) and is also in Omega(g(n))--then T(n) is effectively sandwiched between the two, below c f(n) and above d g(n). If f(n) = g(n), we say that T(n) is in Theta(f(n)): |-----------------------------------------------------------------------------| | Theta(f(n)) is the set of all functions T(n) that are in both of | | | | O(f(n)) and Omega(f(n)). | |-----------------------------------------------------------------------------| But how can a function be sandwiched between f(n) and f(n)? Easy: we choose different constants (c and d) for the upper bound and lower bound. For instance, here is a function T(n) in Theta(n): c f(n) = 10 n ^ / | / T(n) | / ** | / * * | / *** * ** | / * * * | *** / * * * | ** ** / * * * |* ** * * * * / * * ** * | / ** *** ˜˜˜ | / ˜˜˜˜˜ | / ˜˜˜˜˜ | / ˜˜˜˜˜ | / ˜˜˜˜˜ d f(n) = 2 n | / ˜˜˜˜˜ |/ ˜˜˜˜˜ O˜˜------------------------------> n If we extend this graph infinitely far to the right, and find that T(n) remains always sandwiched between 2n and 10n, then T(n) is in Theta(n). If T(n) is an
Background image of page 1

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

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

Page1 / 2

21 - 03/03/09 14:57:33 CS 61B: Lecture 21 Wednesday, March...

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

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