new implementation of knapsack added