adplus-dvertising
frame-decoration

Question

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)

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.

None of the mentioned

Answer: (a).It is the build function of max heap

Engage with the Community - Add Your Comment

Confused About the Answer? Ask for Details Here.

Know the Explanation? Add it Here.

Q. Given the code ,choose the correct option that is consistent with the code. Here A is the heap

Similar Questions

Discover Related MCQs

Q. What is the location of parent node for any arbitary node i?

Q. Given an array of element 5,7,9,1,3,10,8,4. Tick all the correct sequences of elements after inserting all the elements in a min-heap.

Q. Choose the correct properties of weak-heap.

Q. Left child of parent node has value lesser than the parent node.

Q. What is the other name of weak heap?

Q. What is the worst case time in searching minimum value in weak -heap?

Q. The total comparisons in finding both smallest and largest elements are

Q. Does there exist a heap with seven distinct elements so that the Inorder traversal gives the element in sorted order.

Q. The leaf node for a heap of height h will be at which position.

Q. The main distinguishable characterstic of a binomial heap from a binary heap is that

Q. The number of trees in a binomial heap with n nodes is

Q. In a binomial heap the root value is greater than left child and less than right child.

Q. What is order of resultant heap after merging two tree of order k?

Q. Time taken in decreasing the node value in a binomial heap is

Q. Which of these operations have same complexities?

Q. The Statement “Fibonacci heap has better amortized running time in compare to a binomial heap”.

Q. Given a heap of n nodes.The maximum number of tree for building the heap is.

Q. Choose the option with function having same complexity for a fibonacci heap.

Q. What is a hash table?

Q. If several elements are competing for the same bucket in the hash table, what is it called?