Socket
Book a DemoInstallSign in
Socket

knapsack-methods

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

knapsack-methods

Different approaches to solve the [Knapsack problem](https://en.wikipedia.org/wiki/Knapsack_problem#0.2F1_Knapsack_Problem)

latest
npmnpm
Version
0.1.0
Version published
Maintainers
1
Created
Source

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

MIT License

FAQs

Package last updated on 02 Dec 2019

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts