Книга: A Common-Sense Guide to Data Structures and Algorithms in Python, Volume 1
Назад: Wrapping Up
Дальше: Chapter 17: It Doesn’t Hurt to Trie

Exercises

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

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

    /books/45079/OEBPS/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?

Назад: Wrapping Up
Дальше: Chapter 17: It Doesn’t Hurt to Trie