Introduction

Pass, see Knapsack problem

0-1 Knapsack problem

This is the easist knapsack problem. There are items and the volume of your knapsack is . The cost of the th item is and the value of that item is . You need to find the best solution to get the max value.

We define to store the max value of the first i items in the knapsack whose volume is v. Then we have

HDU 2602 is a nake problem of 0-1 knapsack:

Space optimization of HDU 2602:

Reference:

背包问题九讲

Wikipedia