Hint: Priority queue

Question: Say we have a heap priority queue implementation and its array is currently

  51 46 34 31 39 29  7 14  3  1 35  2
How will it look after we insert 42?

Hint: To insert a number, you insert it at the end of the array and work up the heap until the number is less than its parent, or until you reach the top.


Hint: Priority queue / Arrays algorithms / Review questions / 15-211 A, B