CS215 Unit 4 Solutions
CS215 Unit 4 Solutions: Heap
The running time for building a heap by inserting each element one at a time is
Each insertion is
because it runs one operation at each level of the heap and there are levels in the heap.
Therefore the running time is