How to decode the message from a Huffman Encoded bit stream? I am not clear about the idea of Huffman Algorithm.
As far as I understand it, Suppose I am given a text message "My name is XYZ".
Then the encoding process goes this way: 1. Count the frequency of the characters. 2. Sort the frequency by values. 3. Construct a tree. 4. Traverse the tree by considering left-edge as 0 and right-edge as 1 to get to the intended message character. 5. Concatenate the codes to find the bit stream.
Now the problem is, How can I find the original message from the encoded bit stream?
I think we need to construct the Huffman tree again.
But how can I construct the Huffman tree from the bit stream?