1.

Consider the following dynamic programming implementation of the Knapsack problem: Which of the following lines completes the above code?

A. find_max(ans[itm – 1][w – wt[itm – 1]] + val[itm – 1], ans[itm – 1][w])
B. find_max(ans[itm – 1][w – wt[itm – 1]], ans[itm – 1][w])
C. ans[itm][w] = ans[itm – 1][w];
D. ans[itm+1][w] = ans[itm – 1][w];View Answer
Answer» B. find_max(ans[itm – 1][w – wt[itm – 1]], ans[itm – 1][w])


Discussion

No Comment Found