rathoresrikant / HacktoberFestContribute

Please note that contributions made to this repository are not counted as valid for Hacktoberfest 2021.
MIT License
65 stars 660 forks source link

01 Knapsack Problem code in C++ #1264

Closed bharat70 closed 1 year ago

bharat70 commented 1 year ago

The 0/1 knapsack problem means that the items are either completely or no items are filled in a knapsack. For example, we have two items having weights 2kg and 3kg, respectively. If we pick the 2kg item then we cannot pick 1kg item from the 2kg item (item is not divisible); we have to pick the 2kg item completely. This is a 0/1 knapsack problem in which either we pick the item completely or we will pick that item. The 0/1 knapsack problem is solved by the dynamic programming.

bharat70 commented 1 year ago

added knapsack.cpp