You are given as input n items, where item i has a positive real-valued weight wi and a
positive integral value vi. You are also given a positive real-valued capacity W. Note that the weights
need not be integral. Give a dynamic programming algorithm that returns the value of the subset of
items with maximum total value subject to the total weight of the subset being at most W. (You
do not have to construct the actual subset of items.) the running time of your algorithm, should be polynomial in the largest item value vmax = max vi and the number of items n.
You are given as input n items, where item i has a positive real-valued
Share
Another way of doing this would be to compute the minimum total weight required to achieve at least total value T, for successive integer values of T, until it becomes obvious that future minimum weights will all be greater than W. Then look back to find the highest value associated with a weight <= W. I believe that the minimum weights required for each successive integer value of T can be constructed by dynamic programming using the work already done for lesser values of T.