Advertisement

动态规划:0-1背包问题

阅读量:

目录

  1. 01背包问题简介
  2. 详细说明
  3. 状态转移方程详解
  4. 举例
  5. 代码块
  6. 测试结果

01背包问题简介

The 0-1 knapsack problem is defined as follows: Given n items and a knapsack. Each item i has a weight wi and a value vi, and the knapsack has a capacity C. The question asks how to select items to be placed in the knapsack such that the total value of selected items is maximized. For each item i, there are only two choices: either include it in the knapsack or exclude it. Additionally, it is not allowed to place multiple copies of an item into the knapsack or take only a portion of an item. Therefor

全部评论 (0)

还没有任何评论哟~