Question: C2 the following Java Heap class: (a) Complete the put () method of the Heap class such that the put (i metbod puts the key
C2



the following Java Heap class: (a) Complete the put () method of the Heap class such that the put (i metbod puts the key into the heap. (6 marks) (b) Suppose the size of the heap mheap is large enough to accommodate a new key and the aray representation of the heap mheap is shown in Figure 6. Show the result in both beap and its array representation after putting the key 69 into the heap. Figure 6 (4 marks) (c) Based on the following Java Heaptest class: stivn (C2 (Cantinusd) Based on the following Java HeapsortTest class: complete the heapsort (I method of the Heap class sach that the heapSort () method sorts the elements a [0] to a {a. length - 1] using the heap sort method and gives the following output afier suocessfully executing java HeagsortTest. Elements in an array are: 18,22,3,65,81,100,73,21,59 After sorting by heap sort, the elements in the array are: 3,18,21,22,59,65,73,81,100 (5 marks) - End of Section C - - END OF PAPER
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
