This preview shows pages 1–2. Sign up to view the full content.
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 BigOh:
T(n) <= c f(n). ^^^^^^^^^^^
Omega is the reverse of BigOh.
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 BigOh gives us an UPPER
BOUND.
BigOh says, "Your algorithm is at least this good."
Omega says, "Your
algorithm is at least this bad."
If we have bothsay, 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
This preview has intentionally blurred sections. Sign up to view the full version.
View Full Document
This is the end of the preview. Sign up
to
access the rest of the document.
 Spring '01
 Canny
 Data Structures

Click to edit the document details