Professional Documents
Culture Documents
Exercises 10-11
Exercise 10.
In an unsorted array of n elements we want to find one particular element x.
The only information we have is that x is present in the array, and the only
available operation is to look up an element and check whether it equals
x. We call this look-up operation a step. Note that the following questions
are about the number of steps, therefore strictly avoid O()-notation in this
exercise.
10.1. How many steps are needed by any deterministic algorithm, in the
worst case, to find x?
10.2. Now we pick elements at random and look at them until x is found.
However, by some bookkeeping we avoid repetitions and do not pick any
element twice. What is the expected number of steps needed to find x in
this way?
Exercise 11.
In the randomized algorithm for satisfying many clauses we assumed that
every clause has exactly 3 literals.
11.1. How does the algorithm perform if every clause has at most 3 literals?
Will it be better or worse (and in what sense)?
11.2. How does the algorithm perform if every clause has exactly k literals,
where k is any constant number?