The following exercises provide you with the opportunity to practice with heaps. The solutions to these exercises are found in the section, ​ Chapter 16 ​ .

  1. Draw what the following heap would look like after we insert the value 11 into it:

    images/heaps/exercise_1.png

  2. Draw what the previous heap would look like after we delete the root node.

  3. Imagine you’ve built a brand-new heap by inserting the following numbers into the heap in this particular order: 55, 22, 34, 10, 2, 99, 68. If you then pop them from the heap one at a time and insert the numbers into a new array, in what order would the numbers now appear?

Copyright © 2020, The Pragmatic Bookshelf.