Algorithm: int KnapSack(i, j, w[1..n], v[1..n], F[0..n, 0..W])
if F[i, j] < 0 then {
if j < w[i] then value <- KnapSack(i-1, j, w, v, F);
else {
value <- max(KnapSack(i-1, j, w, v, F), v[i] + KnapSack(i-1, j-w[i], w, v, F)); }
F[i, j] <- value;
}
return F[i, j];