Given The Code Choose The Correct Option That Is Consistent #896
Given the code, choose the correct option that is consistent with the code. (Here A is the heap)</p> <pre><code class="language-java"> 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) </code></pre>
This multiple choice question (MCQ) is related to the book/course gs gs121 Data Structures and Algorithms. It can also be found in gs gs121 Heap - Binary Heap - Quiz No.1.
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)
It is the build function of max heap
It is the build function of min heap
It is general build function of any heap
It is used to search element in any heap
Similar question(s) are as followings:
Online Quizzes of gs121 Data Structures and Algorithms
Binary Trees - Binary Search Tree - Quiz No.1
gs gs121 Data Structures and Algorithms
Online Quizzes
Binary Trees - Binary Search Tree - Quiz No.2
gs gs121 Data Structures and Algorithms
Online Quizzes
Binary Trees - Preorder Traversal - Quiz No.1
gs gs121 Data Structures and Algorithms
Online Quizzes