Using backtracking algorithm to solve 0/1 knapsack problem