def knapsack(i, W):
    global weights, values, table, counter
if i < 0:
    return 0
if weights[i] > W:
    table[i][W - 1] = knapsack(i - 1, W)
How to fill a knapsack table when using recursive dynamic programming