0

Please help me and explain the algorithm to decode Huffman encoded Text. (Explain it in just English)

Thanks and Regards, Larry

  • Thanks for that productive idea :-) I finally found the answer. First I thought we cannot use the encoded tree but finally figured that out we can use the tree so now its fine. – IronmanX46 Dec 24 '16 at 08:05

1 Answers1

1

To decode a Huffman Encoded text you would want to use a Huffman tree. The data has been binary encoded so we will go from there.

  • We start from the root. (Iterating through the data) until a leaf is found, for each set of bits, we want to find the corresponding character. If the current bit is 0, that indicates a left node and we move there. If it is 1, we do the same except to the right. If we find a leaf node, we return that character for that node. We then resume iterating through the encoded data.

In essence: 0 = left node, 1 = right node, for each leaf you return that character. You do this from the top to the bottom. I hope this helps!