0

I have a sorted list of n floating point numbers , and i want to split this list into m multiple lists in such a way that the sum of numbers in each list is roughly equal. Any thoughts?

I don't care how many numbers each list gets but the sum of numbers in each list should be fairly equal. One way that i have tried is to take subsections of the list equally (based on m) from the start and from the end and form a list , then shrink the existing list and repeat that process again.

I am fairly successful in that but the last list is either too heavier than others or too small than others , is there any better solution?

timgeb
  • 76,762
  • 20
  • 123
  • 145
Ijaz Ahmad
  • 11,198
  • 9
  • 53
  • 73
  • 1
    http://stackoverflow.com/questions/35517051/split-a-list-of-numbers-into-n-chunks-such-that-the-chunks-have-close-to-equal/35517181 is this the same question? – timgeb Feb 20 '16 at 13:19
  • Possible duplicate of [splitting a list of arbitrary size into only roughly N-equal parts](http://stackoverflow.com/questions/2130016/splitting-a-list-of-arbitrary-size-into-only-roughly-n-equal-parts) – PRVS Feb 20 '16 at 13:20
  • 1
    @PRVS: nope. no sum there. – Karoly Horvath Feb 20 '16 at 13:22

0 Answers0