Dynamic Programming

User Generated

neyvatfgrva

Computer Science

Description

I do not understand these two lines in the knapsack problem. Can someone break it down for me: m[i,w] = m[i-1, w]; if w sub i > w //line 1 m[i,w] = max(m[i-1,w], m[i-1, w - w sub i] + v sub i) if w sub i<= w //line 2 Does line one mean that the benefit of the first i items is the benefit of the first i-1 items? And what does line 2 mean?

User generated content is uploaded by users for the purposes of learning and should be used following Studypool's honor code & terms of service.

This question has not been answered.

Create a free account to get help with this and any other question!

Similar Content

Related Tags