144k views
1 vote
Given the following sequence of integers: 12, 19, 10, 4, 23, 7, 45, 8, 15 Build a heap by inserting the above set, one integer at a time, in the given sequence. Show the heap after every insertion. How many comparisons in all did it take to build the heap? Perform successive delete operations on the heap constructed in the previous step, until the heap is empty. Show the heap after every deletion. How many comparisons in all did it take to perform these deletions?

User Zhao Li
by
5.2k points

1 Answer

3 votes

Answer:

Check the explanation

Step-by-step explanation:

Kindly check the attached images below to see the step by step explanation to the question above.

Given the following sequence of integers: 12, 19, 10, 4, 23, 7, 45, 8, 15 Build a-example-1
Given the following sequence of integers: 12, 19, 10, 4, 23, 7, 45, 8, 15 Build a-example-2
Given the following sequence of integers: 12, 19, 10, 4, 23, 7, 45, 8, 15 Build a-example-3
User Rany Albeg Wein
by
6.0k points