0-1Knapsack
A basic R implementation of the 0-1 knapsack problem.
See https://en.wikipedia.org/wiki/Knapsack_problem for a description of the problem and https://www.youtube.com/watch?v=8LusJS5-AGo for an overview of the solution.
Input:
- Values (stored in array v)
- Weights (stored in array w)
- Number of distinct items (n)
- Knapsack capacity (W)