Computer Science EngineeringModerate

The time needed to build a binary heap from n arbitrary elements using bottom-up heapify is

  1. A. O(n)
  2. B. O(n log n)
  3. C. O(log n)
  4. D. O(n^2)

Correct answer: A. O(n)

The sum of sift-down costs over all levels converges to a linear bound, giving O(n).

More Algorithms, Data Structures & Programming (ISRO CS) questions

Exams that ask this topic