236 views

1 Answer

0 votes
0 votes

In bulid heap heapify is apply to a node only if its children node is heapify. So heapify must be perfome in bottom up order.

  • So at first construct a binary tree.
  • After perfome heapify on bottom up order.
  • So second one is right.

Related questions

311
views
1 answers
0 votes
syedasafoora asked Nov 8, 2023
311 views
Consider the following algorithm for Build-Max-heap and the given array A=[ 47,96, 35, 54, 77, 65, 83]. Run this algorithm on the given array and redraw the heap and the heap-array whenever the swapping takes place. dry run this statement
723
views
1 answers
0 votes
iarnav asked Jun 20, 2018
723 views
I've read and been told that Heapsort can only be applied on Max heap, but this article for G4G states otherwise - https://www.geeksforgeeks.org/heap-sort-for-decreasing- ... min-heap/ So, is it true that HS can be applied also on Min heap?
1.1k
views
1 answers
0 votes
Akash Kumar Roy asked Apr 28, 2018
1,090 views
How much time will it take for deleting $i^{th}$ and a number $n(random)$ node from a heap?
393
views
1 answers
1 votes
gate_forum asked Feb 13, 2019
393 views
Conversion of binary search tree into a Max heap takes:O(n) timeO(nlog n) timeNone