Intermediate
Data Structures & Algorithms
Q54 / 100
What is the time complexity of heapify (build-heap) for n elements?
Correct! Well done.
Incorrect.
The correct answer is D) O(n)
D
Correct Answer
O(n)
Explanation
Build-heap runs in O(n) despite n sift-down operations because lower nodes have smaller subtrees. The total work sums to O(n) by geometric series analysis.
Progress
54/100