### can you make a heap sort from the pseudocode that is below please explain each link 5152517

Can you make a **heap sort** from the pseudocode that is below. Please explain each link of code. The heapsort calls on the downheap which will be responsible for everything and then we have a removeiteam. Its **three methods**, please make the class functional **(in Java.**)

Requirements =

**3 methods. Exactly like in pseudocode. **

**In Java**

The heapSort method (assuming bottom-up construction) Algorithm heapSort (A[n], precedes) Input: array A[n] representing the heap, precedes, a comparator object defining the ordering relationship Output: array A[n] represented a sorted (according to the precedes function) list. int y =n / 2 while (y 0) {//when (root)?? Condition fails downheap (A[n], y, precedes) y = y-1 } /take y and walk it down O(n/2 log n) y:= n while (y 1) temp A[1], A[1] := A[y], A[y] temp, y= y – 1 downheap(A[y], 1, precedes) } O(n log n) Overall efficiency: O(1.5 n log n) The downheap method Algorithm downheap (A[n], j, precedes) // 1 and index1 Input: array A[n] representing the heap, index of the parent's node j, precedes, a comparator object defining the ordering relationship Output: array A[n] with data originally in j walked down until accordingly ordered w.r.t both of its children (according to the precedes function) boolean foundSpot false int I : = j int key A[] int k:= 2 * I while (k /l get the left child first (index n//total children) and (! foundSpot) {// if (k n) and (! precedes (A[k+1], A[k]])//comparisons k = k 1 if (! precedes (A[k], key)) 1= k } // end while A[I] := A[k],//exch k= 2 *I else foundSpot = true A[I] := key// so value of one to root? The removeltem method Algorithm removeltem (H, precedes) Input: heap H[size], precedes, a comparator object defining the ordering relationship Output: boolean variable success set to true if removeltem is successful if H.empty( success := false else { success := true item H[1] H[1] H[size] size := size – 1 downheap(H[size], 1, precedes)} return success The efficiency of removeltem operation is O(log n), where n is the number of tree nodes. else Il go right temp temp.rightChild; if (tempnull) parent.rightChild = newNode; return; class BTLRADT { BTNode root; public BTLRADT () { } } public BTNode getRoot () { return root; } public void insert (char newData) { BTNode newNode = new BTNode (); newNode.data = newData; if (root null) root newNode; else BTNode temp = root; BTNode parent while (true){ wwwww = wwwww parent temp; if (newData temp.data) //go left temp temp.leftChild; if (temp null){ parent.leftChild = newNode; return; } Binary tree nodes (linked representation) class BTNode char data; BTNodel leftChild; BTNode rightChild; BTNode parent; int pos; public BTNode () { } public BTNode (char newData) { data newData } public BTNode (char newData, BTNode newLeftChild, BTNode newRightChild) { data newData leftChild newLeftChild; rightChild newRightChild; www } .methods setData, setLeftChild, setRightChild, getData, getLeftChild, getRightChild displayBTNode follow next.. wwww www ww