Question: [ Knapsack: programming with bookkeeping ] Write Java code implementing the knapsack algorithm discussed in class, and run it against a set of items (
Knapsack: programming with bookkeeping Write Java code implementing the knapsack
algorithm discussed in class, and run it against a set of items i s with values vis and weights
wis and a total weight limit W given in an input text file. An input text file has the following
format:
Your program code should output the content of the memoization table MnW each time a
row is filled. Initialize the memorization table with all s before filling in Additionally, at the
end the program should output the maximum total value of the items selected and the optimal set
of items selected. Use the "bookkeeping" approach to retrieve the resulting optimal set of items
see the lecture slide on "Knapsack: Finding a Solution" to see what the bookkeeping approach
means and implement the backtracking mechanism. See the provided sample input and sample
output files for the output format expected of your program code. Your program code will be
tested with other test input files as well as this sample input file. Two test input and output files
are also provided.
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
