Question
Consider the following dynamic programming implementation of the Knapsack problem:#includeint find_max(int a, int b){ if(a > b) return a; return b;}int knapsack(int W, int *wt, int *val,int n){ int ans[n + 1][W + 1]; int itm,w; for(itm = 0; itm
Answer: Option A
Was this answer helpful ?
find_max(ans[itm “ 1][w “ wt[itm “ 1]] + val[itm “ 1], ans[itm “ 1][w]) completes the above code.
Was this answer helpful ?
Submit Solution