in reply to Perl Drag Racing - sum/delta list

While in some cases there's an advantage of storing the increments instead of the values (it can save space - a technique also used in sampling (but there's not much to gain in Perl, except when your numbers would have been BigInts and your increments aren't)), I don't see the advantage of your complicated first value. Why not add an imaginary 0 before the orginal list and store just the differences? (That means, the first value is the first value). The you only need one pass in both the decoding and encoding.

Abigail

Replies are listed 'Best First'.
Re: Re: Perl Drag Racing - sum/delta list
by John M. Dlugosz (Monsignor) on Aug 16, 2002 at 18:02 UTC
    See my reply to BrowserUk, who asked a similar question.

    Basically, the whole idea is to save space; the more the better (by definition). The numbers, even though "normal" sized, are like BigInts variable-sized in their encoded form, and 0 and other small values have the minimum 1-byte length.

    Since I already know the total size, I can remove one value from the delta list and still figure it out again.

    So the answer to why is "because I can". The requirement is for minimum space and demonstratable (not optimal) logic to deal with it.

    Thanks,
    —John