chap binary trees its occurring (pi )or cn pn this can be reorganized as cn fn ft where fi is the (relativefrequency of letter and ft is the total for all letter frequencies for this set of frequenciesthe expected cost per letter is [( )+( )+( )+( )+( )]/ / fixed-length code for these eight characters would require log bits per letter as opposed to about bits per letter for huffman coding thushuffman coding is expected to save about for this set of letters huffman coding for all ascii symbols should do better than this the letters of figure are atypical in that there are too many common letters compared to the number of rare letters huffman coding for all letters would yield an expected cost of bits per letter the equivalent fixed-length code would require about five bits this is somewhat unfair to fixed-length coding because there is actually room for codes in five bitsbut only letters more generallyhuffman coding of typical text file will save around over ascii coding if we charge ascii coding at eight bits per character huffman coding for binary file (such as compiled executablewould have very different set of distribution frequencies and so would have different space savings most commercial compression programs use two or three coding schemes to adjust to different types of files in the preceding example"deedwas coded in bitsa saving of over the twelve bits required from fixed-length coding however"muckrequires bitsmore space than required by the corresponding fixed-length coding the problem is that "muckis composed of letters that are not expected to occur often if the message does not match the expected frequencies of the lettersthan the length of the encoding will not be as expected either further reading see shaffer and brown [sb for an example of tree implementation where an internal node pointer field stores the value of its child instead of pointer to its child when the child is leaf node