222k views
3 votes
Given the following integer elements: 30, 65, 22, 40, 15, 70, 80, 60, 55, 10 For a and b Show all intermediate steps for full credit. You do not need to show the array representation of the heap.

a. Draw the tree representation of the heap that results when all of the above elements are added (in the given order) to an initially empty maximum binary heap. Circle the final tree that results from performing the additions.

b. After adding all the elements, perform 2 removes on the heap. Circle the tree that results after the two elements are removed.

User JustBoo
by
6.6k points

1 Answer

5 votes

Answer:

See explaination

Step-by-step explanation:

Mass heap:

A max-heap can be defined as a complete binary tree that has all the value in each internal node to be greater than or equal to the values in the children of that node. A min-heap is defined similarly.

Let us make a max heap with the given values.

Please go to attachment.

Given the following integer elements: 30, 65, 22, 40, 15, 70, 80, 60, 55, 10 For a-example-1
Given the following integer elements: 30, 65, 22, 40, 15, 70, 80, 60, 55, 10 For a-example-2
User Persixty
by
7.6k points