http://www.perlmonks.org?node_id=180313


in reply to Re: Puzzle: need a more general algorithm
in thread Puzzle: need a more general algorithm

This is true if your categories all have equal heights. But an optimal solution for a wide height distribution might place, for example, three categories in one column, and one category in each of the other three columns. A sample dataset for which that would be the optimal solution:

my @heights = (4, 4, 4, 1, 1, 1); # in 4 columns
Alan