Tag Archive for: huffman

[A Huffman Code with Maximum Efficiency] Design a Huffman code for a source with probability…

[A Huffman Code with Maximum Efficiency] Design a Huffman code for a source with probability vector
sol:
We use the huffman.m function to determine a Huffman code and the corresponding average codeword length. The resulting codewords are l , 01, 001, 0001, 00001, 00000 l , 0000001, 00000000, and 00000001. The average codeword length is 1.9922 binary symbols per source output. If we find the entropy of the source using the entropy.m function, we see that the entropy of the source is also 1.9922 bits per source output; hence the efficiency of this code is 1.