Question: We can build a heap by repeatedly calling MAX - HEAP - INSERT to insert the elements into the heap. Consider the following variation on

We can build a heap by repeatedly calling MAX- HEAP-INSERT to insert the elements into the heap. Consider the following variation on the BUILD-MAX- HEAP procedure:
{
BUILD-MAX-HEAP (A)
A.heap size 1
for 1-2 to A. length
PAX-HEAP-INSERT (A, A1])
}
Do the procedures BUILD-MAX-HEAP and BUILD- MAX-HEAP' always create the same heap when run on the same input array? Prove that they do or provide a counterexample.

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!