set of codes is said to meet the prefix property if no code in the set is the prefix of another the prefix property guarantees that there will be no ambiguity in how bit string is decoded in other wordsonce we reach the last bit of code during the decoding processwe know which letter it is the code for huffman codes certainly have the prefix property because any prefix for code would correspond to an internal nodewhile all codes correspond to leaf nodes for examplethe code for is ' taking five right branches in the huffman tree of figure brings us to the leaf node containing we can be sure that no letter can have code ' because this corresponds to an internal node of the treeand the tree-building process places letters only at the leaf nodes how efficient is huffman codingin theoryit is an optimal coding method whenever the true frequencies are knownand the frequency of letter is independent of the context of that letter in the message in practicethe frequencies of letters do change depending on context for examplewhile is the most commonly used letter of the alphabet in english documentst is more common as the first letter of word this is why most commercial compression utilities do not use huffman coding as their primary coding methodbut instead use techniques that take advantage of the context for the letters another factor that affects the compression efficiency of huffman coding is the relative frequencies of the letters some frequency patterns will save no space as compared to fixed-length codesothers can result in great compression in generalhuffman coding does better when there is large variation in the frequencies of letters in the particular case of the frequencies shown in figure we can determine the expected savings from huffman coding if the actual frequencies of coded message match the expected frequencies example because the sum of the frequencies in figure is and has frequency we expect it to appear times in message containing letters an actual message might or might not meet this expectation letters dland have code lengths of threeand together are expected to appear times in letters letter has code length of fourand is expected to appear times in letters letter has code length of fiveand is expected to appear times in letters finallyletters and have code lengths of sixand together are expected to appear only times in letters the average expected cost per character is simply the sum of the cost for each character (ci times the probability of