UMBC CMSC441, Design & Analysis of Algorithms, Fall 1999, Section 0201
Fall 1999 Homeworks 5-6
Homework 5, Due Wednesday October 13
1.
Exercise 10.3-8, page 192.
2.
Exercise 10.3-9, page 192.
The optimal location is at the median of the y-coordinates of the oil wells.
Prove why.
3.
Given a (not necessarily sorted) sequence S = {
k1, k2, ..., kn} of n
arbitrary numbers. Consider the collection C of n2 numbers of the form: min{ki, kj},
for
1<= i,j. <=n.
Present an O(n)-time and O(n)-space algorithm to find the
median of C.
Homework 6, Due Wednesday October 20
1.
Exercise 14.2-5, page 267.
2.
Problem 14-2, pages 278-279.
3.
Given an array A of n elements, and an array B of m elements, how
would you find A intersection B? Report your running time in terms of n and m.