New Operation: Merge
Given two heaps, merge them into one heap
first attempt: insert each element of the smaller heap into the larger.
runtime:
second attempt: concatenate heaps’ arrays and run buildHeap.
runtime:
How about O(log n) time?
Previous slide
Next slide
Back to first slide
View graphic version