
CMPS 101
Midterm 1 Review Problems
1. Let
and
be asymptotically non-negative functions which are defined on the positive
integers.
a. State the definition of
.
b. State the definition of
2. State whether the following assertions are true or false. If any statements are false, give a related
statement which is true.
a.
implies
.
b.
if and only if
.
c.
if and only if
, where
.
3. Prove that
))()(())(())(( ngnfngnf
. In other words, if
and
, then
))()(()()(
21
ngnfnhnh
.
4. Use limits to prove the following (these are some of the exercises at the end of the asymptotic growth
rates handout):
a. If
is a polynomial of degree
, then
.
b. For any positive real numbers
and
:
iff
,
iff
, and
iff
.
c. For any positive real numbers a and b:
iff
,
iff
, and
iff
.
d.
.
5. Use Stirling’s formula:
)/1(12! n
e
n
nn
n
, to prove that
.
6. Use Stirling’s formula to prove that
.
7. Consider the following sketch of an algorithm called ProcessArray which performs some unspecified
operation on a subarray
.
ProcessArray(A, p, r) (Preconditions:
and
)
1. do something which takes constant time.
2. if
3.
4. ProcessArray(A, p, q)
5. ProcessArray(A, q+1, r)
Write a recurrence which gives the running time
of this algorithm, when called on the full array
. Give a tight asymptotic solution to this recurrence.
8. Consider the following algorithm which does nothing but waste time: