listing heaps continued whileindex &heaparray[parentgetkey(bottom getkey(heaparray[indexheaparray[parent]/move it down index parentparent (parent- /end while heaparray[indexbottom/end trickleup(/public node remove(/delete item with max key /(assumes non-empty listnode root heaparray[ ]heaparray[ heaparray[--currentsize]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[leftchildgetkey(heaparray[rightchildgetkey()largerchild rightchildelse largerchild leftchild/top >largerchildiftop getkey(>heaparray[largerchildgetkey(break/shift child up heaparray[indexheaparray[largerchild]index largerchild/go down /end while heaparray[indextop/root to index