The requirement of the encoding to be prefix free results in large trees due to the tree having to be complete. Is there a threshold where fixed-length non-encoded storage of data would be more efficient than encoding the data?
Is Huffman Encoding always optimal?
information theory;data compression
The entropy H(A) for this problem is 1.998. Both Huffman coding and fixed length coding for this problem has avg codeword length as 2. And FYI the coding you have got using Huffman Encoding is wrong. Huffman Encoding also produces codes similar to fixed length for this problem. It uses greedy approach. So a doesn't get a code as 0 but instead it gets 00. Rework on the tree you generate using Huffman Coding. The tree you should get is: 