1. Find the big-oh relationships for the following functions.
Give your calculations. [25]
, , , ,
.
2. Let be an array of size , let denote the -th key of ,
let be the key being searched for in , and let be the probability
for .
Suppose that is always found in with the following probability:
for
for
for
where is a constant.
(a) Formulate the equation for computing the average time of the Sequential Search
with the probability distribution given above in terms of and .
Do not compute. [15]
(b) Guess the average time in terms of . [5]
(c) Compute the average time from (a). You do not have to compute the value of yet. [20]
(d) Determine the value of constant in terms of and express the average
time in terms of only. What is the asymptotic average time ? [15]
You may use the following formulas if you need them:
,
,
,
.
3. The length of a path in a graph is the number of edges in the path.
The shortest path problem seeks to find a path of the shortest length between
a give pair of vertices.
Answer the following questions:
(a) Give a decision problem version of the shortest path problem.
Let us call it the shortest path decision problem (SPDP). [5]
(b) Give two certificates for SPDP. [5]
(c) Prove that SPDP is in class NP. [10]