Self-Review Questions

  1. What is the worst-case runtime complexity of finding the smallest item in a min-heap?

  2. What is the worst-case runtime complexity of finding the largest item in a min-heap?

  3. What is the worst-case runtime complexity of deleteMin in a min-heap?

  4. What is the worst-case runtime complexity of building a heap by insertion?

  5. Is a heap full or complete binary tree? :

  6. What is the worst-time runtime complexity of sorting an array of N elements using heapsort?

  7. Given a sequence of numbers: 1, 2, 3, 4, 5
    1. Draw a binary MIN-heap (in a TREE form) by inserting the above numbers reading them from left to right
    2. Show a tree that would be the result after the call to deleteMin() on this heap

  8. Given a sequence of numbers: 1, 2, 3, 4, 5
    1. Draw a binary MAX-heap (in a TREE form) by inserting the above numbers reading them from left to right
    2. Show a TREE that would be the result after the call to deleteMax() on this heap

  9. Given a sequence of numbers: 3, 5, 2, 8, 1, 5, 2
    1. Draw a binary MIN-heap (in an ARRAY form) by inserting the above numbers reading them from left to right
    2. Show an ARRAY that would be the result after the call to deleteMin() on this heap