Page 247 - DCAP201_FUNDAMENTALS_OF_DATA_STRUCTURES
P. 247

Fundamentals of Data Structures




                    Notes










                                   The element 10 is less than the children of the hole, and we percolate the hole down:













                                   Insert 10 in the hole













                                   Delete the next biggest element which is 16:














                                   Swap 16 with the last element of the heap. As 7 will be adjusted in the heap, its cell will no longer
                                   be a part of the heap, instead it becomes a cell from the sorted array:




















          240                               LOVELY PROFESSIONAL UNIVERSITY
   242   243   244   245   246   247   248   249   250   251   252