Algorithm-Huffman

 view release on metacpan or  search on metacpan

Changes  view on Meta::CPAN

0.03  Mon Aug 26
        - implemented encode_bitstring($orig_string) method

0.02  Tue Aug 20
        - implemented $huff->decode_hash method

0.01  Tue Aug 13
        - implemented new and encode_hash method
          * my $huff = new ({$str1 => $count1, $str2 => $count2, $str3 => $count3, ...})
          * my $encode_hash = $huff->encode_hash
	- original version; created by h2xs 1.22 with options
		-XA -b 5.6.0 Algorithm::Huffman

Huffman.pm  view on Meta::CPAN

and to select the one with the shortest encoding bitstring).

=item $huff->encode($string)

Returns the huffman encoded packed bitvector of C<$string>.

Please look to the description of C<encode_bitstring> for details.

=item $huff->decode_bitstring($bitstring)

Decodes a bitstring of '1' and '0' to the original string.
Allthough the encoding could be a bit ambigious,
the decoding is alway unambigious.

Please take care that only ones and zeroes are in the bitstring.
The method will die otherwise.

It will also die if the bitstring isnt complete.
E.g., assuming,
you have a Huffman-Table



( run in 1.005 second using v1.01-cache-2.11-cpan-1c8d708658b )