#### CSCI 3104 - Algorithms - Spring 2009

### Problem Set #3

#### Due: 2pm, Mar 11th, 2009

1. Text problem 2.4.
2. Text problem 2.12.

3. Text problem 2.17.

4. Let A and B be arrays of integers. Each array contains n elements,
and each array is in sorted order (ascending). A and B do not share any
elements in common. Give a O(log n)-time
algorithm which finds the median of A union B. In other words,
find the median of the 2n elements given by putting A and B together into
one array. (**Note:**
Remember the definition from our book (section 2.4) for the median of
a list with an even number of elements.)

5. The text doesn't implement their algorithm for Selection. Please do
so. Then, compute the median of the list of words given
here using your algorithm. (**Note:** Use the standard comparison
for strings (just like strcmp() in C). All words in this list are
distinct.)

- What is the median of the list? Run your program and show the output.
- Run your program 1000 times on the word list and compute the average
number of "split" operations you do for each run.