Convert to a heap, then delete from the top until the heap is over.
Time:
Space:
- swap the top element with the smallest one
- reduce the heap size by 1
- sift down the new top element, currently the smallest, to restore the heap
Convert to a heap, then delete from the top until the heap is over.
Time:
Space: