insertion we place the trickle-up algorithm in its own method the insert(methodwhich includes call to this trickleup(methodis straightforwardpublic boolean insert(int keyif(currentsize==maxsizereturn falsenode newnode new node(key)heaparray[currentsizenewnodetrickleup(currentsize++)return true/end insert(/if array is full/failure /make new node /put it at the end /trickle it up /success we check to make sure the array isn' full and then make new node using the key value passed as an argument this node is inserted at the end of the array finallythe trickleup(routine is called to move this node up to its proper position in trickleup((shown belowthe argument is the index of the newly inserted item we find the parent of this position and then save the node in variable called bottom inside the while loopthe variable index will trickle up the path toward the rootpointing to each node in turn the while loop runs as long as we haven' reached the root (index> )and the key (idataof index' parent is less than the new node the body of the while loop executes one step of the trickle-up process it first copies the parent node into indexmoving the node down (this has the effect of moving the "holeupward then it moves index upward by giving it its parent' indexand giving its parent its parent' index public void trickleup(int indexint parent (index- node bottom heaparray[index]whileindex &heaparray[parentgetkey(bottom getkey(heaparray[indexheaparray[parent]/move node down index parent/move index up parent (parent- /parent <its parent /end while heaparray[indexbottom/end trickleup(