Answer the question
In order to leave comments, you need to log in
How to split array values into different parts?
I have an array of numeric values:
array(16,7,45,23124,45,12231,32345,45,45456,23,456,1212,450...n); // ещё миллион значений
array(16,7,45,23124,45,45656,23,456...n);
array(45,12311,32345...n);
array(45456,23,456,1212,450...n);
Answer the question
In order to leave comments, you need to log in
Similar to the bin packing problem. There are many algorithms. You can solve quickly and suboptimally (first fit), better (best fit) or very long and optimal ( MTP algorithm (8Mb pdf, in English)).
First fit - go sequentially through the numbers and put them in the current container as long as they fit. When filling / overflowing, go to the next container.
Your data is random, there are no regularities, patterns in the distribution of values?
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question