The Procedure Given Below Is Used To Maintain Minorder In The #1001
The procedure given below is used to maintain min-order in the min heap. Find out the missing statements, represented as X.</p> <pre><code class="language-c"> procedure TrickleDownMin(i) if A[i] has children then m := index of smallest of the children or grandchildren (if any) of A[i] if A[m] is a grandchild of A[i] then if A[m] < A[i] then swap A[i] and A[m] X: _______________________ ____________________ endif TrickleDownMin(m) endif else //{A[m] is a child of A[i]} if A[m] < A[i] then swap A[i] and A[m] endif endif </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 - Min/Max Heap - Quiz No.1.
The procedure given below is used to maintain min-order in the min heap. Find out the missing statements, represented as X.
procedure TrickleDownMin(i) if A[i] has children then m := index of smallest of the children or grandchildren (if any) of A[i] if A[m] is a grandchild of A[i] then if A[m] < A[i] then swap A[i] and A[m] X: _______________________ ____________________ endif TrickleDownMin(m) endif else //{A[m] is a child of A[i]} if A[m] < A[i] then swap A[i] and A[m] endif endif
if A[m] > A[parent(m)] then swap A[m] and A[parent(m)]
if A[m] > A[parent(m)] then swap A[i] and A[parent(m)]
if A[m] < A[parent(m)] then swap A[m] and A[parent(m)]
if A[m] > A[parent(m)] then swap A[i] and A[parent(m)]
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