2 DP
2 DP
This assignment has 8 questions, for a total of 100 points. Unless otherwise specified,
complete and reasoned arguments will be expected for all answers.
1
Question 1: Cutting Cloth . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . [121/2]
This is from Dasgupta/Papadimitriou/Vazirani, Exercise 6.14
You’re given a rectangle piece of cloth with dimensions X × Y (X, Y are positive integers), and a list of
n products that can be made using the cloth. For each product i ∈ [1 . . . n] you need a piece of cloth of
dimension ai × bi and the final value of this product is ci . Assume that all ai , bi , ci are positive integers.
You have a machine that can take a rectangular piece of cloth and cut it into two pieces either horizontally
or vertically. Design a strategy to maximize the return for cutting the cloth: i.e a strategy to cut the
cloth into pieces so that the sum of values of the pieces is maximized. It’s fine to duplicate a product
(and sell many copies of it).
The next seven questions are from Erickson (http://web.engr.illinois.edu/~jeffe/teaching/algorithms/
notes/05-dynprog.pdf)
Question 2: Dance, dance ! . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . [121/2]
Problem #4
Question 3: Palindromes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . [121/2]
Problem #5
Page 2