1
CMPS 101
Summer 2009
Homework Assignment 2
Solutions
1.
(1 Point)
p.50: 3.11
Let
)
(
n
f
and
)
(
n
g
be asymptotically nonnegative functions.
Using the basic definition of
Θ

notation, prove that
)))
(
),
(
(max(
)
(
)
(
n
g
n
f
n
g
n
f
Θ
=
+
.
Proof:
Since
)
(
n
f
and
)
(
n
g
are asymptotically nonnegative, there exists a positive constant
0
n
such that
0
)
(
≥
n
f
and
0
)
(
≥
n
g
for all
0
n
n
≥
.
For such
n
we have
))
(
),
(
max(
0
n
g
n
f
≤
))
(
),
(
max(
))
(
),
(
min(
n
g
n
f
n
g
n
f
+
≤
))
(
),
(
max(
2
n
g
n
f
⋅
≤
.
But
))
(
),
(
max(
))
(
),
(
min(
)
(
)
(
n
g
n
f
n
g
n
f
n
g
n
f
+
=
+
, so for all
0
n
n
≥
we have
))
(
),
(
max(
2
)
(
)
(
))
(
),
(
max(
1
0
n
g
n
f
n
g
n
f
n
g
n
f
⋅
≤
+
≤
⋅
≤
.
Thus
)))
(
),
(
(max(
)
(
)
(
n
g
n
f
n
g
n
f
Θ
=
+
, as required.
///
2.
(1 Point)
p.50: 3.13
Explain why the statement “The running time of algorithm A is at least
)
(
2
n
O
” is meaningless.
Solution:
This statement is true under all circumstances, hence it conveys no useful information, and is therefore
meaningless.
To illustrate, let
)
(
n
T
be the running time of algorithm A.
To say that
)
(
n
T
is “at least
)
(
2
n
O
” is to say that
)
(
n
T
is bounded below by a function which is bounded above (asymptotically)
by
2
n
.
If
)
(
n
T
in the class
)
(
2
n
O
, then
)
(
n
T
is bounded below by itself, which is bounded above
asymptotically by
2
n
, and hence the statement is true.
If on the other hand,
)
(
n
T
is in the class
)
(
2
n
Ω
, then
)
(
n
T
is bounded below by
2
cn
(for sufficiently large
n
), which is bounded above
asymptotically by
2
n
, and again the statement is true.
Even if
)
(
n
T
is not comparable to
2
n
,
)
(
n
T
is
bounded below by some positive constant, which is bounded above by
2
n
.
(This is true since even if
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 '09
 AgoreBack
 Negative and nonnegative numbers, LG, Sufficiently large, lg n lg, Arbitrarily large, lg c lg

Click to edit the document details