chap binary trees letter freq code bits figure the huffman codes for the letters of figure right branchesthen leftand finally one last right figure lists the codes for all eight letters given codes for the lettersit is simple matter to use these codes to encode text message we simply replace each letter in the string with its binary code lookup table can be used for this purpose example using the code generated by our example huffman treethe word "deedis represented by the bit string " and the word "muckis represented by the bit string " decoding the message is done by looking at the bits in the coded string from left to right until letter is decoded this can be done by using the huffman tree in reverse process from that used to generate the codes decoding bit string begins at the root of the tree we take branches depending on the bit value -left for ' and right for ' -until reaching leaf node this leaf contains the first character in the message we then process the next bit in the code restarting at the root to begin the next character example to decode the bit string " we begin at the root of the tree and take right branch for the first bit which is ' because the next bit is ' we take left branch we then take another right branch (for the third bit ' ')arriving at the leaf node corresponding to the letter thusthe first letter of the coded word is we then begin again at the root of the tree to process the fourth bitwhich is ' taking right branchthen two left branches (for the next two bits which are ' ')we reach the leaf node corresponding to the letter thusthe second letter is in similar manner we complete the decoding process to find that the last two letters are and kspelling the word "duck