algorithm for performing method removemin using heap is illustrated in figure we know that an entry with the smallest key is stored at the root of (even if there is more than one entry with smallest keyhoweverunless is the only internal node of twe cannot simply delete node rbecause this action would disrupt the binary tree structure insteadwe access the last node of tcopy its entry to the root rand then delete the last node by performing operation remove of the complete binary tree adt (see figure and down-heap bubbling after removal we are not necessarily donehoweverforeven though is now completet may now violate the heap-order property if has only one node (the root)then the heap-order property is trivially satisfied and the algorithm terminates otherwisewe distinguish two caseswhere denotes the root of tif has no right childlet be the left child of otherwise ( has both children)let be child of with the smallest key if ( < ( )the heap-order property is satisfied and the algorithm terminates if instead (rk( )then we need to restore the heap-order propertywhich can be locally achieved by swapping the entries stored at and (see figure and (note that we shouldn' swap with ' sibling the swap we perform restores the heap-order property for node and its childrenbut it may violate this property at shencewe may have to continue swapping down until no violation of the heap-order property occurs (see figure and this downward swapping process is called down-heap bubbling swap either resolves the violation of the heap-order property or propagates it one level down in the heap in the worst casean entry moves all the way down to the bottom level (see figure thusthe number of swaps performed in the execution of method removemin isin the worst caseequal to the height of heap tthat isit is logn by proposition figure removal of the entry with the smallest key from heap( and bdeletion of the last nodewhose entry gets stored into the root( and dswap to locally restore the heap-order property( and fanother swap( and hfinal swap