CSCE 235
Handout
24: Complexity
Assigned April 30, 2003
When we study algorithms, we are interested in
characterizing them according to their efficiency. We are usually interested in the order of growth of the running
time of an algorithm, not in the exact running time. Asymptotic notation gives us a method for classifying
functions according to their rate of growth. (From Prof. Chuck Cusack’s Notes)
An
Asymptotic Upper Bound O-Notation
Definition:
if and only if there
are two positive constants c and
such that
for all
.
If
is nonnegative, we
can simplify the above to
for all
.
We say that “
is big-O of
.” As n
increases,
grows no faster than
.
is an asymptotic
upperbound on
.
Example:
. Proof: Let
and
. Then
.
An
Asymptotic Lower Bound Ω-Notation
Definition:
if and only if there
are two positive constants c and
such that
for all
.
If
is nonnegative, we
can simplify the above to
for all
.
We say that “
is omega of
.” As n
increases,
grows no slower than
.
is an asymptotic
lowerbound on
.
Example:
. Proof: Let
and
. Then we know that
. So
.
An
Asymptotic Tight Bound Θ-Notation
Definition:
if and only if there
are three positive constants
,
, and
such that
for all
.
If
is nonnegative, we
can simplify the above to
for all
.
We say that “
is theta of
.” As n
increases,
grows at the same
rate as
.
is an asymptotic
tight bound on
.
Example:
. Proof: Let
,
, and
. Then we know that
and
. So
.
An
Application
Let
for
N. We
claim that
is
. For small values of
n,
is actually
negative. But since we only care about
large n, we follow standard practice and allow f to have a few
negative values. To check that
is
we observe that
for
;
for all
N,
for
; and so:
![]()
for all large enough n.
![]()
Observations
If
is
and
is
, then
is
and
is ![]()
It follows that if
is a polynomial in n
in which
is the highest power
of n that appears, then
is
.
Transitivity:
If
and
, then
.
If
and
, then
.
If
and
, then
.
![]()
Based on
Chuck Cusack’s Notes, (Ross and Wright 1988,) and (Goodaire and Parmenter
2002).