The Mathematical Garden

 | Welcome  | Games  | Mathematical methods  | About us |
Games
Black and White
HEX
Magic
Mark Six
Recursion, Games and Strategy
The Towers of Hanoi
Sample game - tower of Hanoi
The Fibonacci Numbers
Finding the Maximum Element
A matches game
Sample game - matches
A knapsack problem
A gambler choice
SIM

A knapsack problem

Suppose a 10-lb knapsack is to be filled with three types of items (item 1: b1=4lb, w1=$11, item 2: b2=3lb, w2=$7, item 3: b3=5lb, w3=$12). To maximize total benefit, how should the knapsack be filled ?

Define g(w) to be the maximum benefit that can be gained from w-lb knapsack. Then
g(w) =
max
j=1,2,3 
{ bj + g(w-wj) }.

g(0)=0,     g(1) = g(2) = ?

Department of Mathematics, HKU, 2010