0.1.0 • Published 4 years ago
knapsack-methods v0.1.0
knapsack-methods
Different approaches to solve the Knapsack problem
Usage
npm install knapsack-methods
import { k01 as knapsack } from 'knapsack-methods'
const items = [{ w: 5, b: 5 }, { w: 4, b: 4 }, { w: 3, b: 3 }]
const capacity = 10
knapsack(items, capacity)
// { maxValue: 9, set: [ { w: 4, b: 4 }, { w: 5, b: 5 } ] }
License
0.1.0
4 years ago