University of Virginia - cs3102: Theory of Computation
Spring 2010
Problem Set 6 - Comments
Problem 1: Asymptotic Notation.
The way we advocated using asymptotic notation to de-
scribe algorithm complexity in Classes 22 and 23 is different from how Sipser uses it in Sec-
tion 7.1. Identify at least two ways in which Sispers use of the asymptotic operators differs
from the way we advocated using them in class, and illustrate each with a speciﬁc example
from Sipsers text.
Answer.
Sipsers book sometimes uses the asymptotic notations as sets, but sometimes as if
they produce actual numbers. For example, “Each scan uses
O
(
n
)
steps.” (p. 251). This is
certainly easier than saying, “A function from the input size n to the number of steps used in
each scan would be a member of O(n).”, but it is not strictly correct if we view the asymptotic
operators are producing sets of functions.
Sipser uses equality (e.g.,
f
(
n
) =
O
(
n
3
)
) to show a function is a member of a
O
(
g
(
n
))
class. In
class, we advocated using set membership (e.g.,
f
(
n
)
∈
O
(
n
3
)
) to clearly distinguish between
the case where a function is a member of a set and the case where two sets are equal (e.g.,
O
(
n
)
∪
O
(
logn
) =
O
(
n
)
).
Sipser uses
O
to analyze algorithms, when a tight
Θ
bound could be easily stated. For ex-
ample, in the ﬁrst example above, the number of steps is also known to be in
Θ
(
n
)
. It is not
incorrect to say it is in
O
(
n
)
, but provides much less information than providing the tight
bound.
Problem 2: Asymptotic Propositions.
For each sub-part below, state whether the statement
is
true
,
false
, or
unknown
(where unknown means no one on Earth knows the answer, not
just that you don’t know it!). Include a brief but convincing argument supporting your an-
swer.
a.
Θ
(
n
log
n
)
⊂
O
(
n
2
)
Answer. True
. Intuitively,
O
(
n
2
)
is the set of all functions that grow no faster than
n
2
,
and
Θ
(
n
log
n
)
is the set of functions that grow as fast as
n
log
n
. Since
n
log
n
grows
slower than
n
2
,
Θ
(
n
log
n
)
is a proper subset of
O
(
n
2
)
.
More formally, we will ﬁrst show that
Θ
(
n
log
n
)
⊆
O
(
n
2
)
and then that the inclusion
is proper. Recall from the deﬁnition of
Θ
that
Θ
(
n
log
n
) =
Ω
(
n
log
n
)
∩
O
(
n
log
n
)
. So,
f
(
n
)
∈
Θ
(
n
log
n
)
implies
f
(
n
)
∈
O
(
n
log
n
)
.
By the deﬁnition of
O
this means that there exist positive numbers
c
,
n
0
such that
∀
n
≥
n
0
,
f
(
n
)
≤
cn
log
n
. For all
n
>
1
,
n
log
n
<
n
2
. So,
f
(
n
)
≤
cn
log
n
>
cn
2
implies
f
(
n
)
∈
O
(
n
2
)
.
PS6C-1