CSCI 5454 - Algorithms - Spring 2015

Problem Set #4

Due: 1pm, Mar 9th, 2015



1. Text problem 2.4. Justify your answer.

2. Text problem 2.12. Justify your answer.

3. Text problem 2.17. Justify your answer.

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