trickledown( )return root/end remove(/public void trickledown(int indexint largerchildnode top heaparray[index]/save root while(index currentsize/ /while node has at /least one childint leftchild *index+ int rightchild leftchild+ /find larger child if(rightchild currentsize &/(rightchild exists?heaparray[leftchildidata heaparray[rightchildidatalargerchild rightchildelse largerchild leftchild/top >largerchildif(top idata >heaparray[largerchildidatabreak/shift child up heaparray[indexheaparray[largerchild]index largerchild/go down /end while heaparray[indextop/root to index /end trickledown(/public boolean change(int indexint newvalueif(index=currentsizereturn falseint oldvalue heaparray[indexidata/remember old heaparray[indexidata newvalue/change to new if(oldvalue newvaluetrickleup(index)else trickledown(index)return true/end change(/if raised/trickle it up /if lowered/trickle it down /public void displayheap(system out print("heaparray")/array format