Heapify
Heapify is the process of creating a heap data structure from a binary tree.
We can create a heap from an array in , and not . The reason is that we are starting from the last value of the heap in the array.
- Starts from the parent of the last element in the array and iteratively performs the fix-down operation to maintain heap property. fix-down is constant time therefore he overall time is .
Answer from quiz Module 2:
Used in Heap Sort.