Question: Problem 3 ( 1 0 points ) Consider the 0 - 1 knapsack problem. In class, we developed an algorithm that works in time O
Problem points
Consider the knapsack problem. In class, we developed an algorithm that works in time where is the number of objects and is the capacity of the knapsack. This algorithm is good if is small but what happens when is really big? The running time can become really bad.
In this problem, we will develop an alternative DP algorithm whose running time will be where is the sum of all object values. For this, we define OPT to be the minimum weight of a subset of the items dots, that achieve value at least Answer the following questions:
a Having computed all OPT values, what is the solution of the original problem? Why?
b pt What is OPT for Why?
c What is OPT Why?
d pts Write a recursive formula for OPT in terms of other OPT values. Justify how you came up with this expression. Hint. Again consider whether you select object or not.
e pt How many subproblems are there overall? Why?
f pt How do you fill the matrix OPT of solutions? Why?
g pts Describe an algorithm in a few lines that uses the recurrence for OPT to solve this problem with dynamic programming. What will the running time of the resulting algorithm expressed with the notation?
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
