|
Huffman encoding is a process by which data is compress into a special encoding based on the frewquency of a letter or character. More can be found here about it, but I find it extremely interesting and cool. Below is some Perl code that encodes and decodes using Huffman's method.
Huffman.pm A rudimentary Perl module that facilitates Huffman encoding and decoding; it is limited, and chokes on strings that contain "1" and "0" because I was lazy and treated the encoded 1's and 0's as characters and did not put in any escape (or bit stuffing for you l337 nerdz) capabilities into the decode process. huff.pl Driver for Huffman encoding Perl module linked above Here is a link to a turing machine that computes the huffman code: http://semillon.wpi.edu/~aofa/AofA/msg00040.html .. neat! |
|