The knapsack problem is that given a set of positive integers { a1,……,an } , and knapsack of size s , find a subset A of { a1,……, an }such that the sum of elements in A is the largest , but at most s.
Part 1. Use the dynamic programming method to design an algorithm for the knapsack problem. Prove the correctness of your algorithm. Show the computational time of your algorithm carefully.
Part2. 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.
Just did this for another person. Got interested in the problem, and working on an optimized version.
However, had to stop due to other commitments. Can do it for you.
Hello. How are u.
I saw your description .
I understood it and can do it well.
I have done several project like this.
I'm an expert in Data Structures and Algorithms.
And I know Java ,C/C++,C# and Python well.
I'm interested this project.
I want to discuss with you about this project.
If it's possible,please contact me and explain more detail.
I wait your good reply.
Bye.
I am a PhD student in computer science, specializing in data mining and machine learning. I am well versed with c++ and dynamic programming. I would be happy to help you in your project and we could discuss details of your project in chat.
Hello Sir/Madam, We have gone through the details you have provided and we have already worked on a similar project before and can deliver as u have mentioned and would be pleased to work on this with you to deliver the results that you have expected and we have already worked on a similar project before and can deliver as u have mentioned
We are sure you will not be disappointed if you give us this opportunity. Our team is experienced, creative & efficient enough to get your job done well. We have an impeccable record and all our clients enjoy working with us, we are sure that you will too, our prices are cheapest in market.
can u provide your email or sky-pe etc for further discussion about the project
I am ready to discuss with you
with best Regards