knapsack dynamic progr heuristic working perfectly in O(n²v_max) time