write bit string Encode each word using the preceding huffma
write bit string
Encode each word using the preceding huffman code. NEED Given huffman code:Solution
In order to generate a huffman code we need to traverse the tree to the value you want, outputing a 1 every time we take a lefthand branch, and a 0 every time we take a righthand branch.
Given string is \"NEED\"
For generating the string \"N\" we need to traverse right-left-right from the root of the tree. It\'s code therefore is 010.
 For generating the string \"E\" we need to traverse right-right from the root of the tree. It\'s code therefore is 00.
 For generating the string \"D\" we need to traverse right-left-left-left-left from the root of the tree. It\'s code therefore is 01111.
Hence, the bit string corresponding to the Huffman encoding as per the given code of the string \"NEED\" is 010000001111

