Question: 1. We are going to implement a class for the maximum binary heaps based on integer arrays. You need to define a class for the

1. We are going to implement a class for the maximum binary heaps based on integer arrays. You need to define a class for the heaps such that it has only one member variable which is the reference to an array which keeps the content. You are required to implement the following methods besides the appropriate constructors.

1.1. Displaying all of the element in the heap.

1.2. Inserting a new value to the heap and ensuring that the resulting heap is still a max-heap.

1.3. Deleting the maximum value from the heap and ensuring that the resulting heap is still a max-heap.

2. Implement a static method, you may put it along with the main method, which sorts the input integer array in ascending order using heap sort. You may use the max-heap class implemented in the previous task.

3. Writing at least two test cases for the heap sort.

Step by Step Solution

3.46 Rating (153 Votes )

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock

Using Java programming language CODE public class HeapClass private int HeapArray our heap array to ... View full answer

blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!