Python Forum
Dividing list into subsets
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Dividing list into subsets
#5
Some info is missing.
The proposed list looks very sorted. Is that always the case ?
In case it is, you have a lot more chances to find a simple algorithm.
You might take the group average of the list , that is 9....
Now you start from the left and place the stick when the sum reaches that +/- number.
In this case it might be a coincidence. Do you have a larger example?
Paul
Edit:
I have to refine the previous somewhat: (created a random list with 50+ items, 20 sticks)
I concocted some heuristic that uses the average and the standard deviation.
You start from the left adding items until the sum + sdev > average.
Then you place a stick etc. This is a recursive function, because if you have
sticks left over, deduct 1 from the average and start again.
The tests i ran found a solution within 2 iterations.
To say that this is an algorithm will require some solid proof. :-)
It is more important to do the right thing, than to do the thing right.(P.Drucker)
Better is the enemy of good. (Montesquieu) = French version for 'kiss'.
Reply


Messages In This Thread
Dividing list into subsets - by Michael11 - Oct-01-2020, 12:26 PM
RE: Dividing list into subsets - by deanhystad - Oct-01-2020, 09:08 PM
RE: Dividing list into subsets - by Michael11 - Oct-02-2020, 06:43 AM
RE: Dividing list into subsets - by deanhystad - Oct-02-2020, 10:34 PM
RE: Dividing list into subsets - by DPaul - Oct-04-2020, 09:47 AM
RE: Dividing list into subsets - by Michael11 - Oct-04-2020, 10:23 AM
RE: Dividing list into subsets - by DPaul - Oct-04-2020, 05:13 PM
RE: Dividing list into subsets - by Katenn - Oct-04-2020, 06:13 PM
RE: Dividing list into subsets - by DPaul - Oct-05-2020, 06:34 AM
RE: Dividing list into subsets - by deanhystad - Dec-11-2020, 09:51 PM
RE: Dividing list into subsets - by deanhystad - Dec-12-2020, 06:18 AM

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020