
Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!

ECS122A: Algorithm Design and Analysis Due: 5:00pm, May 7, 2009 Homework Assignment #
i vi wi 1 40 100 2 35 50 3 18 45 4 4 20 5 10 10 6 2 5
The total weight W = 100.
(a) Find the greedy solutions by using following possibilities: (i) Greedy by value, i.e., at each step select from the remaining items the one with the highest value (ii) Greedy by weight, i.e., at each step select from the remainin g items the one with the least weight. (iii) Greedy by the value per pound, i.e., at each step select from the remaining items with the largest ratio vi/wi. (b) Compute the solution by dynamic programming (attach a copy of your program) (c) Briefly comment your findings.
describe both your tree and the actual binary encoding.