Heaps - Study Mode

[#161] What happens if the null path length is not updated?
Correct Answer

(B) all null path lengths will be 0

[#162] What is the ancestor of the leaf node in a given minimum ternary heap?
Correct Answer

(A) 1

[#163] What does this pseudo_code return? int myfun(heap_arr[])
{
int mini=INF

for(int i=0

i<tot_node

i++)
mini=min(mini,heap_arr)
return mini

}
Correct Answer

(C) Root of the heap

[#164] For construction of a binary heap with property that parent node has value less than child node. In reference to that which line is incorrect. Line indexed from 1. 1. add(int k)
2. {
3. heap_size++

4. int i = heap_size - 1

5. harr[i] = k

6. while (i != 0 && harr[parent(i)] < harr[i])
7. {
8. swap(↔[i], ↔[parent(i)])

9. i = parent(i)

10. }
11. }
Correct Answer

(C) Line - 6

[#165] What is the complexity of given function of insertion. insert(int n)
{
if(buffer_size()< maxi_biffer_size())
buffer_aar[ind]==n

else
move_to_heap(buffer,buffer+maxi_buffer_size())
}
Correct Answer

(B) amortized O(1)