Write a program to solve the Knapsack problem using hill climbing algorithm. Your code should contain a method called Knapsack, the method takes two parameters, the first is a 2xN array of integers that represents the items and their weight and value and the second is an integer that represents the maximum weight of the knapsack. Assume that the initial state is an empty Knapsack, and the actions are either putting objects in the Knapsack or swapping objects from in and out of the Knapsack.
Knapsack problem using hill climbing algorithm
algorithm