Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Part 2: Use c++ to implement the function below Int Knapsack (int *a, //the inpu

ID: 645509 • Letter: P

Question

Part 2: Use c++ to implement the function below

Int Knapsack (int *a,          //the input integers

                        Int n,            //the number of input integers

                        Int s,             //Knapsack size

                        Int *subset,    //subset elements

                       Int &size_of_subset       //the number of items in the subset)

Test your program for the following knapsack problem:

Input list : 5,23,27,37,48,51,63,67,71,75,79,83,89,91,101,112,121,132,137,141,143,147,153,159,171,181,190,191   with Knapsack size 595.print out a subset with the sum of its elements so that the sum has the closest distance to 595.Also print out your source code.

Explanation / Answer

int knapsack(int value[], int weight[], int C, int n) { for(int i = 1; i