implemented recursive knapsack