Page 195 - DCAP407_DATA_STRUCTURE
P. 195

Data Structure



                          frequency 8+8=16. This new node DE is the parent node of the nodes D and E, and DE replaces D and E
                          as shown in figure 10.16.
                                                 Figure 10.16: Step 1 for Constructing Huffman Tree












                          Again we sort the nodes  based on their frequency of occurrence.  Now  DE  and  C  have the  least
                          frequencies i.e., 16 and 10 each. This time we combine DE and C to create a new node DEC having
                          frequency 26.
                          Nodes DE and C are replaced by their parent DEC as depicted in figure 10.17.

                                                 Figure 10.17: Step 2 for Constructing Huffman Tree












                          Similarly, combine B with frequency 12 and DEC with frequency 26 to create BDEC. BDEC becomes
                          the parent of B and DEC with frequency 38. At last only two nodes are left namely, BDEC and A. We
                          again sort them and combine both to form ABDEC which has a frequency count of 62.




















                          188                     LOVELY PROFESSIONAL UNIVERSITY
   190   191   192   193   194   195   196   197   198   199   200