Last week our teacher gave us a question about Huffman Encoding Algorithm described as below.
HUFFMAN ENCODING ALGORITHM:
- Consider all pairs: .
- Choose the two lowest frequencies, and make them brothers, with the root having the combined frequency.
- Iterate.
The question was to find the Final Binary Tree
and Variable Length Codes
for the given Alphabets using the above defined Huffman Encoding Algorithm:
A | 10
B | 20
C | 30
D | 40
E | 50
F | 60
I solved the question but my teacher said that I made the wrong tree. Kindly check my answer below and tell me where I am wrong?
MY ANSWER:
Final Binary Tree:
Variable Length Code:
Kindly tell me where I am wrong? What wrong I did while making the above Binary Tree?