Given two arrays namely weights and price, and the capacity of the knapsack(container) M, determine the item(s) that are to be included in the knapsack so that the total weight is less than or equal to a given limit and the total price is as large as possible(max. profit).
Simply we need to find the most valuable subset of the items that fit into the knapsack and here, will find the total value i.e max profit.
Please open this in your pc or with a compatible app in your mobile.
C++ Implementation for KNAPSACK PROBLEMThat's it from this blog post. If you liked it then do share this blog with your friends or people who wanna get into programming world. Thank You!