An array of integers of size n can be converted into a heap by adjusting the…

GATE · 2004 · IT

An array of integers of size n can be converted into a heap by adjusting the heaps rooted at each internal node of the complete binary tree starting at the node ⌊(n - 1) /2⌋, and doing this adjustment up to the root node (root node is at index 0) in the order ⌊(n - 1)/2⌋, ⌊(n - 3)/ 2⌋, ....., 0. The time required to construct a heap in this manner is

  1. A.

    O(log n)

  2. B.

    O(n)

  3. C.

    O (n log log n)

  4. D.

    O(n log n)

Attempted by 395 students.

Show answer

Correct answer: B

The worked solution is available to enrolled students.

Explore the full course: Iocl Engineers Officers Grade A Paper 2

Loading lesson…