Phác Chí Huấn
New member
Given the code, choose the correct option that is consistent with the code. (Here A is the heap)
A. It is the build function of max heap
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
Code:
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)
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