in reply to breaking an array into nearly equal parts
Did you notice a pattern in the table you pasted? It looks like it contains all the information you need. It's basically like this:
If $x%3 is 0, the arrays should all be of size $x/3. If $x%3 is not 0, there should be $x-($x%3) arrays of size $x/3 and $x%3 of size $x/3+1.
I'm not positive this will continue to hold true, but it looks good from what you've shown. There may be a simpler algorithm too, so I would be happy to see other replies. :-)
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^2: breaking an array into nearly equal parts
by spiritway (Vicar) on Dec 14, 2005 at 05:40 UTC | |
by Roy Johnson (Monsignor) on Dec 14, 2005 at 18:32 UTC |
In Section
Seekers of Perl Wisdom