knapsack

Solving 0/1 Knapsack problem using Dynamic Programming

Introduction A knapsack is a bag with straps, usually carried by soldiers to help them take their valuables or things which they might need during their journey. The 0/1 knapsack problem is a very famous interview problem. The problem statement is as follows: Given a set of items, each of which is associated with some weight and value. Find the subset of items which can be carried into the knapsack with weight limit W. It is required that the cumulative value of the items in the knapsack is maximum value possible. In simple words, it asks you to pick certain items from the set of items ...
Read More

Solving 0/1 Knapsack problem using Recursion

Introduction A knapsack is a bag with straps, usually carried by soldiers to help them take their valuables or things which they might need during their journey. The 0/1 knapsack problem is a very famous interview problem. The problem statement is as follows: Given a set of items, each of which is associated with some weight and value. Find the subset of items which can be carried in a knapsack of capacity W (where W is the weight). It is required that the cumulative value of the items in the knapsack is maximum value possible. In simple words, it asks you to pick certain items from the...
Read More