AI engineering glossary · Data structures algorithms
What is heapify?
Heapify (also called sift down, sift up): The procedure of turning an unordered array into a valid heap, or of restoring the heap property after one element changes, by moving elements down (sift down) or up. Building a heap from n items this way takes O(n) time.
Heapify: an example
Turning [9, 4, 7, 1] into a min-heap by sifting down from the last parent yields [1, 4, 7, 9].
Related terms
More Data structures algorithms terms
- Heuristic
- Huffman coding
- In-place algorithm
- Insertion sort
- Interval scheduling
- Kadane's algorithm
- Knapsack problem
- Knuth-Morris-Pratt algorithm
Where you learn it
Heapify is part of the AI Engineering Program, which teaches it with notes, a hands-on lab and an exam. The first lesson is free.