Vidyalelo
Data Structure · Q85

Heaps

Programming · Data Structure · question 85

Q85

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 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)

A.
It is the build function of max heap
Answer
B.
It is the build function of min heap
C.
It is general build function of any heap
D.
It is used to search element in any heap

Answer: Option A

Solution

Answer: Option A
No explanation is given for this question Let's Discuss on Board