Huffman Code

  1. Construct a Huffman code for the following character frequency distribution:
    E I N P R S
    0.50 0.20 0.03 0.02 0.10 0.15

  2. Generate the Huffman code for the following characters and calculate the ACL:
    Character Frequency Huffman Code
    A 0.20  
    B 0.10  
    C 0.20  
    D 0.15  
    E 0.30  
    F 0.05  
    average code length  

  3. The compression ratio of a code is defined as the minimum constant code length for an input alphabet, divided by the code's ACL. Compute the compression ratio for the code you obtained above.