Given an unsorted array of size 10
int[] arr={∞,1,2,3,4,5,6,7,8,9,10};
If I execute code
public void build_heap(){
for(int i=size/2;i>=1;i--)
max_heapify(i);
}
The resulting array in what case follow binary tree properties
( ie left subtree < root & root < right subtree )
? How to generate such an array ?
Is this the right approach :
Instead of using build_heap
, keep I will keep inserting the element into the heap ? (Is there a better solution?)