Knapsack using hash tables instead of items x size matrix