add iterative method for knapsack problem