1.Say that we code 256 different letters. Let num(X) be the number of times an arbitrary letter appears in the text . Assume that for every X and Y both num(Y ) > num(X)/2 and num(X) > num(Y)/2 hold. Is the ASCII (8 bits) code worse than the Huffman code in this case?
No, the ASCII code will work equivalently as huffman code in this case. In both type of coding we will require 8 bits for each character.
For the huffman coding to optimise the required bits, the difference in number of appearance of characters must not be following the above condition.
The largest time appearing number in this case is always less than twice the smallest appearing number.
So that makes sum of any two numbers of appearance of letters less than any number's occurence, and hence we can't get any benifit of huffman coding.
Get Answers For Free
Most questions answered within 1 hours.