Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

Checking if Inserting values in order into an initially empty minimum binary heap is correct

Can someone tell me if I have produced the right minimum binary heap after inserting these values in order into an initially empty minimum binary heap?

[23, 41, 19, 59, 10, 15, 40]

enter image description here

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

>Solution :

Yes. That is the correct result for that input.

The heap evolves as follows:

       23
      _23
     /  
   41
      _19_
     /    \
   41      23
      _19_
     /    \
   41      23
  /
 59
      _10_
     /    \
   19      23
  /  \
 59  41
      _10_
     /    \
   19      15
  /  \    /
 59  41  23
      _10_
     /    \
   19      15
  /  \    /  \
 59  41  23  40
Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading