sol10 - CIS 435, Spring 2002, Jim Calvin Homework #10...

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

View Full Document Right Arrow Icon
CIS 435, Spring 2002, Jim Calvin Homework #10 Solutions 16.2-3 Suppose we have n items with weights w 1 w 2 ≤ ··· ≤ w n and values v 1 v 2 ≥ ··· ≥ v n . The optimal algorithm is: take items 1 , 2 ,... ,k where k is the frst integer such that w 1 + w 2 + ··· + w k +1 >L . To show that this is optimal, we frst show that an optimal solution contains item 1 (assuming that L>w 1 ). IF not, replace any chosen item with 1 and the weight is no greater and the value is at least as high. Thus there is an optimal solution containing item 1. An optimal solution to the subproblem with items 2 through n must contain item 2, and so on. 16.2-4 ProF. Midas should drive as Far as he can on each tank oF gas without
Background image of page 1
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 09/29/2010 for the course CS CS 435 taught by Professor Alex during the Spring '09 term at NJIT.

Ask a homework question - tutors are online