关于背包的问题?

questions about knapsack?

美好的一天,

背包算法并不完全"click"在我的脑海中。我知道如何很好地回答不同变体的背包问题(0-1 背包,携带香料的背包等),但我并不完全理解算法本身;我很乐意填补空白

为了让我的问题不那么含糊,我将我的问题分解为几个子问题。另外这是我在考试中对背包问题的典型答案,

Construct X-dimensional matrix (where X is a number of variables to keep an eye on). From point 0 {0,0,...0}, calculate neighbouring nodes, and then from the results obtained, will the next diagonal point in the matrix with the result giving by far the most optimal solution. Repeat until all considered options in the algorithm are exahusted

干杯

1) 由于背包算法是一个贪心算法,我们知道该算法有贪心选择属性(也为某个最优解做出选择)并且它有最优子结构。因此,不可能有更好的结果,因为我们的算法总是选择最佳决策。