Where in the heap?
==================

Which nodes in a heap could possibly contain the fourth-highest element
in the heap, assuming that no two elements have the same value?

a.  anywhere except the root
b.  anywhere in level 0, 1, 2, or 3
c.  *anywhere in level 1, 2, or 3*
d.  in level 1 or 2, or in the left half of level 3

Adding to a heap
================

             100
            /   \
          19      36
        /  \     / \
      17    3   25  1
     / \
    2   7

  --------------------------- -- ----------------------------------------------------------------------------------------------------------------------------------------------------------
  ![a small heap](heap.png)      Suppose we add a new element 26 to this heap. *Not including the new node*, how many nodes will have a different value from before after this operation?
  --------------------------- -- ----------------------------------------------------------------------------------------------------------------------------------------------------------

a.  0
b.  1
c.  *2*
d.  3

Removing from a heap
====================

              73
            /    \
          64      61
        /   \     / \
      42     52  19 48
     /  \   /  \
    25  26 12  31

  ---------------------------- -- -----------------------------------------------------------------------------------------------------------------
  ![a small heap](heap2.png)      If we dequeue the top element from this heap, what will be the values of the first seven nodes in the new heap?
  ---------------------------- -- -----------------------------------------------------------------------------------------------------------------

a.  73, 64, 61, 42, 52, 19, 48
b.  31, 64, 61, 42, 52, 19, 48
c.  64, 61, 52, 48, 42, 31, 19
d.  *64, 52, 61, 42, 31, 19, 48*

Searching a heap
================

Suppose we have implemented a priority queue with an array-based heap.
What is the worst-case running time of the fastest possible contains
method, if the heap has N elements?

a.  O(1)
b.  O(log N)
c.  *O(N)*
d.  O(N log N)

Min-cost search
===============

    XL
    HH
    LY

There are two paths of length 5 from (0, 6) (marked as X) to (2, 7)
(marked as Y). Which one will the priority queue based search find
first?

a.  X → (1, 6) → (2, 6) → (2, 7)
b.  X → (0, 7) → (1, 7) → (2, 7)
c.  some other path
d.  *depends upon the priority queue implementation*

