11.07.2015 Views

hamming

hamming

hamming

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

11Coding Theory—IITwo things should be clear from the previous chapter. First, we want the average length L of the messagesent to be as small as we can make it (to save the use of facilities). Second, it must be a statistical theorysince we cannot know the messages which are to be sent, but we can know some of the statistics by usingpast messages plus the inference the future will probably be like the past. For the simplest theory, which isall we can discuss here, we will need the probabilities of the individual symbols occurring in a message.How to get these is not part of the theory, but can be obtained by inspection of past experience, orimaginative guessing about the future use of the proposed system you are designing.Thus we want an instantaneous uniquely decodable code for a given set of input symbols, s i , along withtheir probabilities, p i . What lengths l i should we assign (realizing we must obey the Kraft inequality), toattain the minimum average code length? Huffman solved this code design problem.Huffman first showed the following running inequalities must be true for a minimum length code. If the p iare in descending order then the l i must be in ascending orderFor suppose the p i are in this order but at least one pair of the l i are not. Consider the effect of interchangingthe symbols attached to the two which are not in order. Before the interchange the two terms contributed tothe average code length L an amountand after the interchange the terms would contributeAll the other terms in the sum L will be the same. The difference can be written asOne of these two terms was assumed to be negative, hence upon interchanging the two symbols we wouldobserve a decrease in the average code length L. Thus for a minimum length code we must have the tworunning inequalities.Next Huffman observed an instantaneous decodable code has a decision tree, and every decision nodeshould have two exits, or else it is wasted effort, hence there are two longest symbols which have the samelength.To illustrate Huffman coding we use the classic example. Let p(s 1 )=0.4, p(s 2 )=0.2, p(s 3 )=0.2, p(s 4 )=0.1,and p(s 5 )=0.1. We have it displayed in the attached Figure 11.I. Huffman then argued on the basis of theabove he could combine (merge) the two least frequent symbols (which must have the same length) into one

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!