Question: please send correct answer for thumbs up Write a C program for the following problem. There are n items in a house. A thief breaks
Write a C program for the following problem. There are n items in a house. A thief breaks into that house and the constraint is that the thief cannot carry more weight than W. The thief by now knows the weight and profit value of each item in the house. Devise an algorithm using dynamic programming strategy to find out which items the thief should steal so that he can carry a max. weight of W. For example n=4 W=5 Weights of items : 2 1 3 2 Profits of items : 12 10 20 15 Output: 1101 Note: Read the number of items, knapsack capacity and weights of items and profits of items from the user. Print the solution. For example: Input Result 1101 4 5 2 1 3 2 12 10 20 15
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
