hw3(8) - CS 573 Homework 3 (due October 18, 2010) Fall 2010...

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
CS 573 Homework 3 (due October 18, 2010) Fall 2010 CS 573: Graduate Algorithms, Fall 2010 Homework 3 Due Monday, October 18, 2010 at 5pm (in the homework drop boxes in the basement of Siebel) 1. Suppose we are given two arrays C [ 1.. n ] and R [ 1.. n ] of positive integers. An n × n matrix of 0s and 1s agrees with R and C if, for every index i , the i th row contains R [ i ] 1s, and the i th column contains C [ i ] 1s. Describe and analyze an algorithm that either constructs a matrix that agrees with R and C , or correctly reports that no such matrix exists. 2. Suppose we have n skiers with heights given in an array P [ 1.. n ] , and n skis with heights given in an array S [ 1.. n ] . Describe an efficient algorithm to assign a ski to each skier, so that the average difference between the height of a skier and her assigned ski is as small as possible. The algorithm should compute a permutation σ such that the expression 1 n n X i = 1 ± ± P [ i ] - S [ σ ( i )] ± ± is as small as possible.
Background image of page 1
This is the end of the preview. Sign up to access the rest of the document.
Ask a homework question - tutors are online