82.
Given the pseudo code, state whether the function for merging of two heap is correct or not?
mergeTree(p,q)
if p.root.value <= q.root.value
return p.addTree(q)
else
return q.addTree(p)

85.
Given the code, choose the correct option that is consistent with the code. (Here A is the heap)
build(A,i)
left-> 2*i
right->2*i +1
temp- > i
if(left<= heap_length[A] ans A[left] >A[temp])
temp -> left
if (right = heap_length[A] and A[right] > A[temp])
temp->right
if temp!= i
swap(A[i],A[temp])
build(A,temp)

87.
If we implement heap as min-heap, deleting root node (value 1)from the heap. What would be the value of root node after second iteration if leaf node (value 100) is chosen to replace the root at start.
Heaps mcq question image

Read More Section(Heaps)

Each Section contains maximum 100 MCQs question on Heaps. To get more questions visit other sections.