fixed issue with knapsack algorithm and minimum array index method.