notes in this examplethe new item to be inserted has the key note that you cannot simply drop the new item into the next position in the complete tree because the resulting tree is no longer heap ordered insteadthe hole in the heap is moved toward the root by moving items down in the heap as shown in figure (band (cthe process of moving items down terminates either when you reach the root of the tree or when the hole has been moved up to position in which when the new item is inserted the result is heap program gives the code for inserting an item in binary heap the enqueue method of the binaryheap class takes as its argument the item to be inserted in the heap if the priority queue is full an exception is thrown otherwisethe item is inserted as described above public class binaryheap extends abstractcontainer implements priorityqueue protected comparable[arraypublic void enqueue (comparable objectif (count =array length throw new containerfullexception ()++countint =countwhile ( &array [ / isgt (object)array [iarray [ / ] /= array [iobject/program binaryheap class enqueue method the implementation of the algorithm is actually remarkably simple lines - move the hole in the heap up by moving items down when the loop terminatesthe new item can be inserted at position thereforethe loop terminates either at the rooti= or when the key in the parent of iwhich is found at position / is smaller than the item to be inserted notice too that good optimizing compiler will recognize that the subscript calculations involve only division by two thereforethe divisions can be replaced by bitwise right shifts which usually run much more quickly since the depth of complete binary tree with nodes is log nthe worst case running time for the enqueue operation is log nt(isgto(log )where (isgtis the time required to compare to objects if (isgto( )the enqueue operation is simply (log nin the worst case lovely professional university