Data Compression V: Compression in Unix I: Huffman Coding (pack and unpack)
Suppose messages are made of letters a, b, c, d, and e, which appear with probabilities .12, .4, .15, .08, and .25, respectively.
We wish to encode each character into a sequence of 0’s and 1’s so that no code for a character is the prefix for another.
Answer (using Huffman’s algorithm given on the next slide): a=1111, b=0, c=110, d=1110, e=10.