This preview shows pages 1–2. Sign up to view the full content.
This preview has intentionally blurred sections. Sign up to view the full version.View Full Document
Unformatted text preview: Introduction to Algorithms Solution Set 2 CS 482, Spring 2008 (1) The algorithm restores the websites in decreasing order of c i /t i , where c i is the rate of lost dollars per hour for site i , and t i is the number of hours to finish the job. Analysis of running time. Computing the ratio for each job requires O ( n ) time, and sorting them requires O ( n log n ) time. Correctness. The proof of correctness uses an exchange argument, similar to the proof of correctness of the scheduling algorithm in Section 4.2 of Kleinberg & Tardos. If you have a schedule with two consecutive jobs i,j (in that order) and you swap the order of i and j , the net change can be broken down as follows. • Site i is restored t j hours later, which increases the lost revenue by c i t j . • Site j is restored t i hours earlier, which decreases the lost revenue by c j t i . • All other sites are restored at the same time. Thus the net change in lost revenue is c i t j- c j t i = c i t i- c j t j t i t j . (1) This implies the following facts. 1. In any optimal schedule, there can’t be two consecutive jobs i,j such that ( c i /t i )- ( c j /t j ) is negative. If there were, one could decrease the lost revenue by swapping the order of i and j . 2. Therefore, in every optimal schedule, the jobs are sorted in order of decreasing c i /t i ....
View Full Document
This note was uploaded on 10/02/2008 for the course CS 482 taught by Professor Kleinberg during the Spring '08 term at Cornell University (Engineering School).
- Spring '08