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?
This question has not been answered.
Create a free account to get help with this and any other question!
24/7 Homework Help
Stuck on a homework question? Our verified tutors can answer all questions, from basic math to advanced rocket science!
Similar Content
Related Tags
How to Win Friends and Influence People
by Dale Carnegie
Into Thin Air
by Jon Krakauer
Sounds Like Titanic
by Jessica Chiccehito Hindman
Where'd You Go Bernadette
by Maria Semple
My Brilliant Friend
by Elena Ferrante
The Restless Wave
by John McCain
One Flew Over the Cuckoos Nest
by Ken Kesey
The BFG
by Roald Dahl
Ezperanza Rising
by Pam Muñoz Ryan