Answer the question
In order to leave comments, you need to log in
How to break numbers into approximately equal groups?
It is necessary to break a group of given numbers into approximately equal portions with a given limit. I can't find the formula to use.
Example: split a group of numbers [1,55,99,45,14,53,78,20,22,46] into groups, with a total of no more than 100.
While writing the question, the toaster showed me a similar question about load balancing, there was a split into two threads, and solved this problem about the knapsack. But I'm not sure if this will work for me.
Answer the question
In order to leave comments, you need to log in
you sort the array and take values from the edges until you reach the limit. Then you take it again from the edges into another pile. Due to this, the largest numbers will be in a pile with the smallest. The solution is not optimal, but no combinatorics and linear complexity.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question