Given an array of numbers, partition them into a number of buckets, preserving order, where the ranges of each bucket are as close as possible.
npm install linear-partitioning
|4||downloads in the last month|
|Version||0.3.1 last updated 4 months ago|
|Keywords||linear, partition, algorithm, problem, buckets|
The Partition Problem
Input: given an array of S non-negative numbers and an integer k (the number of partitions we want)
Output: Partition S into k ranges, so as to minimize the maximum sum over all the ranges.
var partition = require('linear-partitioning'); partition([1,2,3,4,5,6,7,8,9], 3); > [[1,2,3,4,5], [6,7], [8,9]]