How is a heap different from a binary search tree?
BST’s guarantees global order, where heaps only guarantee level orders
When do you use a heap over a BST?
If you only care about min and max operations, BST’s are good at all finds (O(logn))
How does heapsort work? (High-level)
Take unsorted array and insert into a heap. Removing from the heap will return items in a sorted order!
What is the runtime of heapsort?
O(n log n)
What is the run time of heap insert and remove?
O(log n)