Heaps Exercises

  < Previous  Next >
  1. Discuss the following in a group of 3-5 people. Be prepared to share your group's conclusions.
    1. What are the advantages of using a heap data structure?
    2. Name several scenarios where a heap is advantageous.
    3. Name some scenarios where a heap is not advantageous.
  2. Are the following heaps valid? If not, do they violate the structure and/or heap-order property?
    A. B. C.
    D. E.
  3. Insertions and Deletions
    1. Draw the resulting heap after inserting 10, 12, 1, 14, 6, 5, 8, 15, 3, 9, 7, 4, 11, 13 and 2 into an initially empty binary heap and show its array representation.
    2. Using the heap from the previous question, what does top() return?
    3. Using the heap from the previous question, draw the heap and its array after a call to pop().
    4. Using the heap from the previous question, what does top() return?
    5. Using the heap from the previous question, draw the heap and its array after a call to pop().
    6. Using the heap from the previous question, what does top() return?
    7. Using the heap from the previous question, draw the heap and its array after a call to pop().
  4. What are the following Big-Ohs for Heaps?
    Operation Average-case Worst-case
    insert    
    top    
    pop    

Last Modified: