Question: Array Heap Implementation) (10 marks) 1. Implement an array-based heap data structure which should at least include the heapInsert and heapDelete methods. This implementation of

Array Heap Implementation) (10 marks)

1. Implement an array-based heap data structure which should at least include the heapInsert and heapDelete methods. This implementation of a heap will store integers and will be a max heap (root stores the maximum integer). Create a program that creates an instance of your data structure and tests each method. Pseudocode for the implementation can be found in module 3, unit 4, lesson 2 in the course content (4 marks)

2. What is the efficiency of finding the maximum element in the heap you implemented in question 1? What is the efficiency of finding the minimum element? Will the maximum element always be the root? Will the minimum element always be found in a leaf node? (2 marks)

3. Draw the heap tree diagram resulting from adding the following integer array in order into a max heap: {10, 5, 8, 12, 14, 4, 2, 6, 1, 7}. (2 marks)

4. Delete 14 from the heap diagram in question 3. Draw the resulting diagram. (2 marks) USE JAVA

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock 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 Databases Questions!