chap binary trees /*put element in its correct place *private void siftdown(int posassert (pos > &(pos "illegal heap position"while (!isleaf(pos)int leftchild(pos)if (( <( - )&(heap[jcompareto(heap[ + ] ) ++/ is now index of child with greater value if (heap[poscompareto(heap[ ]> returndsutil swap(heapposj)pos /move down public removemax(/remove maximum value assert "removing from empty heap"dsutil swap(heap -- )/swap maximum with last value if ( ! /not on last element siftdown( )/put new heap root val in correct place return heap[ ]/*remove element at specified position *public remove(int posassert (pos > &(pos "illegal heap position"dsutil swap(heappos-- )/swap with last value /if we just swapped in big valuepush it up while (heap[poscompareto(heap[parent(pos)] dsutil swap(heapposparent(pos))pos parent(pos)if ( ! siftdown(pos)/if it is littlepush down return heap[ ]figure (continued