x.Hmellspacing=\"0\" cellpadding=\"5\" width=\"100%\" border=\"0\"> Picture show
ID: 3617542 • Letter: X
Question
x.Hmellspacing="0" cellpadding="5" width="100%" border="0"> Picture shows the binary tree for the variable length code discussed above. It also gives you an idea how to construct the Huffman code. You can start the process considering each leaf node as individual binary tree. Then keep combining them appropriately until you end up with just one tree! As shown in the picture, once you have the final tree structure, you have the codeword for each char automatically. You may know that each character is stored as one byte in the file. In other words, it uses the fixed length code of 8 bits. When files are zipped, character distribution is analyzed and new variable length code is designed to shrink the contents in zip file. In simple words, more frequent characters are assigned smaller code. Let us look at an example which uses 3 bit fixed size code: Character a b c d e f Frequency (in thousands) 45 13 12 16Explanation / Answer
Dear, in your problem as the frequencies of each of the fivecharacters a,b,c,d,e,f are different. therefore, the optimalhuffman encoding will be that we give the lowest huffman encodinglength to the character with highest frequency. which in this casewill be length of 1 bit then we should give the encoded bit length 2 to the character willsecond highest frequency, and so on based on your data..the best solution will be as under character encoded length a 1 b 3 c 4 d 2 e 5 f 6 the algorithm will be like as under for each character in the array or file compute the frequency of each character if no two or more frequencies of any characters are same then assign the encoded length of 1 to the character with highestfrequency repeat this process for all characters if frequencies of any of two characters match then make those characters as leaf nodes and join them withroot. Hope it helps you...
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.