Sort A and B into decreasing order.
July 11, 2007
Exercises 16.2-6
Select the median m of the , and partition the items into three set A,B and C. A is greater then m, B is equal, C is less than m. If the summation W’ of A is less than W, then we should recursive solve the problem of (B+C, W-W’). If the summation W’ of A is greater than W, then we should recursive the problem (A, W).
Exercises 16.2-5
Cover the points from left to right. We should cover as many as possible point as we can.
Exercises 16.2-3
Take one item one at a time according to the order. If x can be taken, then take it.
Exercises 16.2-2
Let c(i,k) be the optimal solution for first i objects into knapsack with size k. The recursive formula is .