in reply to Re (tilly) 3: alternating row colors
in thread alternating row colors

I appreciate tilly's posting so much, that I just had to make figures from it. I modified it a bit to find the maximum offset for various array_lengths. Here are the graphs:
Simple: max_offset 1600 ++----------+----------+-----------+-----------+----------+----- +-----++ + + + + +'/tmp/out.txt'** +***** + 1400 ++ * + ++ | * + | | * + | 1200 ++ * + ++ | * + | 1000 ++ * + ++ | * + | 800 ++ * + ++ | ****** * + | | * ********** * + | 600 ++ * *********** * + ++ | * ****** + | 400 ++ * * + ++ | *********** * + | | * ****** + | 200 ++ ********* + ++ + * **** + * + + + + + + 0 *****-------+----------+-----------+-----------+----------+----- +-----++ 0 100 200 300 400 500 + 600 array_length Better axes: max_offset / array_length 9 ++------+-------+-------+-------+--------+-------+-------+-------+- +-----++ + + + + + + +'/tmp/out2.txt'+* +***** + 8 ++ * + ++ | * * + | | * * + | 7 ++ * * + ++ | * * + | 6 +* * + ++ |* * + | 5 *+ * + ++ | * + | | * + | 4 ++ * + ++ | ** + | 3 ++ * * * ** * * * + ++ | ** ** ** *** ** ** ** + | | * * * * ** * ** **** **** * + | 2 ++ * * ** * *** * ** * ** * *** * + ++ + + + ** *+ ** * ****+ ****+ ** * **** + + 1 ++------+-------+-----**+------**------**+-----**+------**------**- +-----++ 1 2 3 4 5 6 7 8 9 + 10 log2( array_length)
That's clear: a jump at every 2**(1..$n) length of the array. The jump is to 3 times the array_length at the jump. So now we can deduct the perl source code from this {grin}.

There are small deviations due to the poor representation of lines on the ASCII field. For smaller array lengths, this relation does not hold.

Jeroen
"We are not alone"(FZ)