Weighted Interval Scheduling
Homework 7
(Maximum 50 points + extra credit 25 points)
Due 11:59 p.m. of the class Friday March 30, 2018
Show the steps of deriving your answers. Points will be deducted for answers without adequate
steps discussed. Submit the written part of your homework via Blackboard as one PDF or Word
document. Submit Java codes via Blackboard as well.
1. (25) [Weighted Interval Scheduling: algorithm tracing] Consider the dynamic
programming algorithm we discussed for the weighted interval scheduling problem. Show the
trace of running a bottom-up (i.e., iterative) implementation of the algorithm on the problem
instance shown below. Show the trace in the same manner as in Figure 6.5 (page 260) of the
textbook. Remember to number the jobs in the increasing order of their finish times.
2. (25) [Rising trend] Textbook Exercise 17 in Chapter 6. The problem to solve is, in other
words, to select from a sequence of n numbers a subset, including the first number, such that the
selected numbers make a longest monotonously increasing sequence. In the exercise b, build the
optimal substructure (with an explanation), write the iterative dynamic programming algorithm
(pseudocode), and show the running-time analysis. Hints: the algorithm in the exercise a is a
greedy algorithm; the answer returned in the exercise b is the length of the longest rising trend
starting from P[1], so think “backward” beginning from P[1].
3. (25: optional after two required) [Knapsack: programming] Write Java code
implementing the knapsack algorithm discussed in class, and run it twice against the set of items
shown below, once with W = 10 and once with W = 11. (W is the constraint on total weight.)
The program should output the content of the memoization table M[0..n][0..W] each time a row
is filled. Additionally, at the end, the program should output the items included in the optimal set
and the resulting maximum total value of the items included. Use the “bookkeeping” approach
to retrieve the resulting optimal set of items – see the lecture slide to see what the bookkeeping
approach means.
Submit the source codes and the run output as via Blackboard. Your program should work
correctly; no point will be given to a program that is not working correctly. In addition, program
codes should be neatly organized and well commented; there will be many points deducted for
codes that are hard to read.
Last modified: March 23, 2018
The post Weighted Interval Scheduling appeared first on My Assignment Online.
