committing knapsack code