Solution:-
(a) The table has been constructed according to bottom up dynamic approach of 0/1 Knapsack algorithm. Along the horizontal axis you have the weights upto the capacity of the bag that is 7 and along the vertical axis you have items.
| Item | 1 | 2 | 3 | 4 | 5 |
| Weight | 2 | 3 | 5 | 2 | 7 |
| Pounds | 9 | 12 | 14 | 8 | 20 |
Knapsack table:

(b) Items included in the final configuration are Item 1 , Item 2 , Item 4.
(c) The maximum value that can fit in the knapsack using a configuration of these items is 29.
3. Apply the dynamic programming algorithm discussed in class to solve the knapsack problem. (20 points)...
1. Apply the dynamic programming algorithm discussed in class to solve the knapsack problem. (10 points) a. Show the completed table. b. Which items are included in the final configuration of the knapsack? c. What is the maximum value that can fit in the knapsack using a configuration of these items? item 1 2. 3 4 weight 3 2 value $25 $20 $15 1 capacity W = 6. 4 5 $40 $50 5
a) Implement the bottom-up dynamic programming algorithm for the
knapsack problem in python. The
program should read inputs from a file called “data.txt”, and the
output will be written to screen,
indicating the optimal subset(s).
b) For the bottom-up dynamic programming algorithm, prove that its
time efficiency is in
Θ(nW), its space efficiency is in Θ(nW) and the time needed to find
the composition of an
optimal subset from a filled dynamic programming table is in
O(n).
Consider the following...
Write an algorithm that uses dynamic program to find a solution to the knapsack problem. The input is the capacity of the knapsack then each row of the table of values and weights. The output is the resulting maximum value of the items that can be put in the knapsack. Code submitted in C++ Sample Input 1: 11 1 1 6 2 18 5 22 6 28 7 Sample Output 1: 40 Sample Input 2: 8 15 1 10 5...
Apply the top-down (i.e., memory function) dynamic programming
algorithm to the following instance of the knapsack problem. Input
your results in the table shown below. For empty cells, input a
single minus sign (-) into the cell.
Warning: When filling in the table below with your
answers, be sure to type the number in each cell, with no decimal
points or leading zeros or spaces. For example, if a cell should
contain a value of 0, just type "0" and...
Algorithm and computing system(Python) What is dynamic programming? Why does it usually work faster? Using the dynamic programming solution for the knapsack problem, compute a solution to this knapsack problem: Weight value 2 16 3 19 4 23 5 28 total number of items = 4 capacity of the knapsack = 7 Suppose that the similarity between an object O and 6 other objects in the database A,B,C,D,E and F are as follows: sim(A,O) = 0.1 sim(B,O) = 0.3 sim(C,O)...
Haloo , i have java program , Java Program , dynamic program Given a knapsack with capacity B∈N and -n- objects with profits p0, ..., p n-1 and weights w0, ..., wn-1. It is also necessary to find a subset I ⊆ {0, ..., n-1} such that the profit of the selected objects is maximized without exceeding the capacity. However, we have another limitation: the number of objects must not exceed a given k ∈ N Example: For the items...
In weighted knapsack problem, given the knapsack capacity is 16 and the following items (Weight, Value), what is the maximum value we can take away. Explain shortly how and by what approach you arrived at this solution. Item 1 (4, 12) Item 2 (3, 14) Item 3 (7, 22) Item 4 (8, 32) Item 5 (4, 24) Item 6 (6, 20)
ALGORITHM
Given the following Knapsack problem instance and its DP solution: 1 2 3 4 5 weight value To 10 10 10 10 item1 1 10 item2 | 2 17 item3 11 11 21 21 28 28 item4 15 0 11 121 121 128 36 According to the solution table, the maximum item value that we can achieve 36. By reconstructing the solution, we know that the following items {1,3,4} are included in the solution. Carefully, fill in the following...
2. Apply Dijkstra’s algorithm as discussed in class to solve the single-source shortest-paths problem for the following graph. Consider node a to be the source. (10 points) a. Show the completed table. b. State the shortest path from A to J and state its length. c. State the shortest path from A to K and state its length. d. State the shortest path from A to L and state its length. 3 5 6 4 3 2 1 2. d...
Please explain step by step,
thank you so much!
0-1 Knapsack (N=6, W=10) Item Weight Value (lb) ($) 8 1 0 10 Weight limit w(lb) 4 5 6 7 2 2 2 2 2 2 3 2 #2 2 1 2 43 33 3 w #3 0 2 3 3 #4 56 w 2 a #6 7. (10%) (Cont.) Unbounded Knapsack Problem (1-Dim Dynamic Programming) Weight limit w 0 : 6 Weight limit w F(w) 7 Unbounded Knapsack (N=6, W=10)...