1. Find the big-oh relationships for the following functions.
Give your calculations. [30]
,
,
,
,
.
2. Let
be an array of size
, let
denote the
-th key of
,
let
be the key being searched for in
by Sequential Search, and let
be the probability
for
.
Suppose that
is always found in
with the following probability:
for
for
where
is a constant.
(a) Formulate the equation for computing the average number of comparisons
of the Sequential Search
with the probability distribution given above in terms of
and
.
Do not compute. [5]
(b) Estimate the average number of comparisons made without any calculations. Justify your answer. [10]
(c) Compute the average time from (a). You do not have to compute the value of
yet. [13]
(d) Determine the value of constant
in terms of
and express the average
number of comparisons in terms of
only. [12]
You may use the following formulas if you need them:
,
,
,
.
3. A set cover of size
of a set S is a collection of
subsets of S
such that every element
of the set S is included in at least one of the subsets of the collection.
The set cover problem asks whether or not a set cover of size
exists
in a given collection of subsets of a given set.
(a) Give a certificate for the set cover problem. [10]
(b) Give an outline of your verification algorithm for the certificate of (a). [10]
(c) Is the set cover problem isn class NP ? Justify your answer. [10]