CSCI 3104 - Algorithms - Spring 2010

Problem Set #3

Due: 3pm, Feb 24th, 2010

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 Θ(lg 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.)