Home Manual Reference Source

:school_satchel: @problem-solving/knapsack


© xkcd.com

Knapsack problem algorithms for JavaScript. See docs.

import {
    knapsackGreedy,
    knapsackApprox,
} from '@problem-solving/knapsack';

knapsackGreedy(n, v, w, W); // 1/2 approximation
knapsackApprox(eps, n, v, w, W); // 1-eps approximation

License Version Tests Dependencies GitHub issues Downloads

Code issues Code maintainability Code coverage (cov) Code technical debt Documentation Package size

:book: References