New Features in Python 1.6
François Pinard
pinard at iro.umontreal.ca
Tue Apr 4 13:04:15 EDT 2000
Lloyd Zusman <ljz at asfast.com> writes:
> I'll use the new compression algorithm I recently invented. It's amazing!
> .. it compresses *anything* down to one bit.
Beware. It might be patented already... Let's see. Does it work this way?
* If the file is empty, you're done.
* If the file holds a single bit, you're done.
* Split the whole file into pairs of sequences, the first part of the pair
being an eager, but possibly empty sequence of consecutive zero-bits,
the second part being an eager, but possibly empty sequence of consecutive
one-bits. Notice that there is only one way to do this split.
* Replace each sequence above by the count of bits it contains, expressed
directly as a binary number for the first count of the pair, and as the
one-complements of the binary number for the second count of the pair.
Notice that given these counts, it is trivial to rebuild the contents
of the previous step.
* Iterate.
--
François Pinard http://www.iro.umontreal.ca/~pinard
More information about the Python-list
mailing list