7. Value: 25
Value: 40 Value: 50
Value: 15Value: 20
Weight: 4
Weight: 1Weight: 2
Weight: 3
Weight: 5Space: 6(weight)
Value: ????
Get the Maximum Value:
store
8. Get the Maximum Value:
Now, We are facing a big problem.
There are many options to get the maximum value.
This problem is called
knapsack problem.
Good thing is. There is an algorithm to solve this.
Today, we are going to learn this
9. Solve Knapsack Problem:
• Firstly, create a table store the data.
Item 1 2 3 4 5
Value 25 20 15 40 50
Weight 3 2 1 4 5
• Secondly, get the ratio value/weight.
Item 1 2 3 4 5
Value 25 20 15 40 50
Weight 3 2 1 4 5
Value/weight 8.3 10 15 10 10