Question

14 18 11 10 19 16 23 28 15 21 Again, recall that in a Java program, a binary heap is stored as an array with the first elemen

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

Steps to delete an element in min heap:

1. Delete the node that contains the value you want deleted in the heap.

2. Replace the deleted node with the farthest right node.

3. Heapify (Fix the heap):

if the heap property holds true

then you are done.

else if the replacement node value its parent nodes value then swap them, and repeat step 3.

else

swap the replacement node with the smallest child node, and repeat step 3.

output:

T[0..12]=[#,6,14,7,16,18,11,10,19,21,23,28,15]

Add a comment
Know the answer?
Add Answer to:
14 18 11 10 19 16 23 28 15 21 Again, recall that in a Java...
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