notes figure (aillustrates the problem the dequeuemin operation removes the key from the heapbut it is the node containing key that must be removed from the tree to make it into complete tree again when key is removed from the roota hole is created in the tree as shown in figure (bthe trick is to move the hole down in the tree to point where the left-over keyin this case the key can be reinserted into the tree to move hole down in the treeyou consider the children of the empty node and move up the smallest key moving up the smallest key ensures that the result will be min heap the process of moving up continues until either the hole has been pushed down to leaf nodeor until the hole has been pushed to point where the left over key can be inserted into the heap in the example shown in figure ( )-( )the hole is pushed from the root node to leaf node where the key is ultimately placed is shown in figure (dprogram gives the code for the dequeuemin method of the binaryheap class this method implements the deletion algorithm described above the main loop (lines - moves the hole in the tree down by moving up the child with the smallest key until either leaf node is reached or until the hole has been moved down to point where the last element of the array can be reinserted public class binaryheap extends abstractcontainer implements priorityqueue protected comparable [arraypublic comparable dequeuemin(if (count = throw new containeremptyexception ()comparable result array [ ]comparable last array [count]--countint while ( count int child iif (child count &array [child islt (array [child])child + if (last isle (array [child])breakarray [iarray [child] childarray [ilastreturn result/program binaryheap class dequeuemin method lovely professional university