Heap Operations: Exercise

  • Trace the core operations of Priority Queue with Binary Heap implementation.

Exercise Consider an empty min-heap. Show (draw) the resulting heap in tree form after each of the following operations:

insert(10)
insert(5)
insert(8)
insert(1)
insert(14)
remove()
insert(12)
insert(3)
insert(7)
remove()
Solution