
CS1510 Design and Analysis of Algorithms, Fall 2006
Homework 3. Assigned on Wed Sep 20, 2006. Due in class on Wed Sep 27, 2006.
1. Consider the following problem of scheduling jobs to minimize maximum lateness. The
input to this problem consists of n jobs. Each job j has a length pj and a deadline dj. We
want to schedule these jobs on one machine. In a schedule S, let Cj be the time that job j
completes in S. The lateness of j, denoted Lj, is defined as Lj = Cj - dj. Note that the lateness
of a job could be negative if it finishes before its deadline. The maximum lateness of
schedule S, denoted Lmax, is defined as Lmax = maxj Lj where the maximum is taken over all
jobs. The goal is to find a schedule that minimizes the maximum lateness.
Algorithm Shortest-Processing-Time (SPT) runs a job with the smallest processing time first.
Prove or disprove that SPT is optimal for this problem.
2. Algorithm Earliest-Deadline-First (EDF) runs a job with the smallest deadline first. Prove or
disprove that EDF is optimal for the problem of scheduling jobs to minimize maximum
lateness.
3. Consider the following gas stops problem. You want to drive from Pittsburgh to
Philadelphia along I76. When the gas tank is full, the car can go for 100 miles. You have a
map that shows the distance between gas stations on your route. Suppose you want to make
as few gas stops as possible along the way. Assume that any pair of consecutive gas stations
is no more than 100 miles. Describe an algorithm to determine which gas stations to stop and
prove that the algorithm gives an optimal solution.
4. Consider the following Longest Increasing Subsequence (LIS) problem. The input to this
problem consists of a sequence S of n numbers. The i’th number is vi. A sequence X is a
subsequence of sequence S if X can be obtained from S by removing zero or more elements
of S. For example, (3,1,5) is a subsequence of (3,8,6,1,5,7). A sequence X is increasing if
the numbers in sequence is ordered from small to large. For example, (1,2,4,7,9) is
increasing, but (2,3,6,4) is not. The goal of the problem is to find a longest increasing
subsequence X of S. Describe an algorithm for this problem and justify your answer.
1