Home / MCQ Bank / Computer
Computer Heaps

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

Select the best option to verify your answer:
Show Correct Answer
Correct Answer: Option A • if A[m] > A[parent(m)] then swap A[m] and A[parent(m)]

Related Computer Questions

Which of the following comes with tools to build your own R packages? What is the purpose of database normalization? What will be the output of the following C++ code? #include <iostream> using namespace std; int main () { int n; n = 43; cout << hex << n << endl; return 0; } What is the syntax for the 'if-else' statement in C++? Which of the following property is used to align the text in a table?