Knapsack Problem Using Backtracking
Knapsack Problem Using Backtracking
Knapsack Problem Using Backtracking
• Problem Definition
• Solution
• Algorithm
• Example
• Time complexity
Problem Definition
• We are given n objects and a knapsack or bag. The objective is to
obtain a filling of the knapsack that maximizes the total profit
earned.
Given
– n = number of weights
– w = weights
• Then We are going to the next object, if the object weight is exceeded
that object does not fit. So unit of that object is ‘0’.(i.e.) K=0.