Here answer is 8. With 1024 nodes, we can easily build min heap Check following diagram
Now once we place 1-9 then remaining elements can be placed easily to fill up heap (While keeping heap property of course) Total elements we need for this heap is 512, we have given 1024 ! So Yes, 8 is answer !
yes ...heap should be a complete binary tree and here also it is a complete BT. Because we have total 1024 elements and with height(or depth) = 9 we can have total (2(9+1) - 1) = 1023 element in complete BT.
Why 511 elements are required? element 9 is present at a depth of 8, but in a heap it is not necessary that depth 8 should be completely filled. SO, all depths upto 7 should be filled and it requies 2(7+1) -1 elements upto depth 7 and 1 element 9.
babai in image akash just put imagination of tree .. in his ans right of root node i.e. 1 there are 255 nodes in arragment which satisfies the given condition... like then right of node 2 there are 127 nodes... like this tree will be look like...
Step 0: Study the topic/subject. Use Bikram ...