|Think about Loose Coupling|
Re: Re: Puzzle: need a more general algorithmby Ovid (Cardinal)
|on Jul 09, 2002 at 02:56 UTC||Need Help??|
It appears that I have confused a few people here. What I need "minimized" is the aggregate height per column as summed from @height data.
Given the heights of qw/ 10 10 15 20 10 10 /, I could conceivably construct a table with no column having greater than 20 items in it:
The following solution, would fail because one of the columns has 25 items:
Part of the problem, I suspect, is that I had a bug in my original code because I accidentally posted the wrong version. The @distribution array needs to be reset every iteration. The following is correct:
I hope that's clear, now :)
I also have to add that there's a heck of a lot more discussion on this than I thought there would be.
Join the Perlmonks Setiathome Group or just click on the the link and check out our stats.