Question

The following array is not a heap. 22,15,16,14,11,13,7,10,18,2,9,8,4 After calling MAX-HEAPIFY to correct that violation, the...

The following array is not a heap.

22,15,16,14,11,13,7,10,18,2,9,8,4

After calling MAX-HEAPIFY to correct that violation, the resulting array will be a heap. Show it in array form:

0 0
Add a comment Improve this question Transcribed image text
Answer #1

A Binary Heap is a complete binary tree which is either Min Heap or Max Heap. In a Max Binary Heap, the key at the root must be maximum among all keys present in Binary Heap. This property must be recursively true for all nodes in Binary Tree.

{22,15,16,14,11,13,7,10,18,2,9,8,4} this given array is not a heap,so when we calling MAX-HEAPIFY function that will make given array to max-heap.

There are many possible max heap for {22,15,16,14,11,13,7,10,18,2,9,8,4}
some are:-
{22, 18, 16, 15, 11, 13, 7, 10, 14, 2, 9, 8, 4}
{22, 18, 16, 15, 14, 11, 13, 7, 10, 2, 9, 8, 4 }
22 18 \Ь 15 11 13 + // To 19 2 93 { 22 , 18, 10, 15, 1, 13, 1, 10, 11, 2, 3, 8,43

22 18 16 . 13 15 11 3 14 7 10 2 ġ 8 4 { 22,18,16,15,14,11,13,7,10,2,9,8,45

Add a comment
Know the answer?
Add Answer to:
The following array is not a heap. 22,15,16,14,11,13,7,10,18,2,9,8,4 After calling MAX-HEAPIFY to correct that violation, the...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT