note
japhy
Here's the algorithm:
<code>use constant COL => 4;
my @data = qw( 10 15 25 30 10 13 );
my @cols = map [$_], @data;
while (@data > COL) {
my $i = 0;
my $s = $data[$i] + $data[$i+1];
for my $j (1 .. @data-2) {
($i, $s) = ($j, $data[$j] + $data[$j+1])
if $data[$j] + $data[$j+1] < $s;
}
splice @data, $i, 2, $s;
splice @cols, $i, 2, [@{ $cols[$i] }, @{ $cols[$i+1] }];
}</code>
<p>
<font color="#ff0000">_____________________________________________________</font><br>
Jeff<tt>[<font color="#0000ff"><A HREF="/index.pl?node=japhy&lastnode_id=1072">japhy</A></font>]</tt>Pinyan:
<a href="http://www.pobox.com/~japhy/modules/">Perl</a>,
<a href="http://www.pobox.com/~japhy/docs/book.html">regex</a>,
and <a href="http://lists.perl.org/showlist.cgi?name=perl5-porters"><i>perl</i></a>
<a href="http://foldoc.doc.ic.ac.uk/foldoc/foldoc.cgi?query=hacker">hacker</a>, who'd like a <b>[http://www.pobox.com/~japhy/resume.txt|job]</b> (NYC-area)
<br>
<tt>s++=END;++y(;-P)}y js++=;shajsj<++y(p-q)}?print:??;</tt>
180276
180276