Question Description
Consider the following “Max-heapify” algorithm.Array has size at least n and 1in.After applying The Max-heapify noded at A[i], the result will be the subtree of A[1,….n] rooted at A[i] is a max-heapify.{ Assume that except root A[i], all its children satisfies heap property]Max –heapify (int A[ ], int n,int i){ int p,m;p = i;while (2pn){if(Y && Z)m = 2p+1;else m =2p;if(A[p][swap (A[p],A[m]);p=m;}elsereturn ;}}Find missing statements at Y and Z respectively to apply the heapify for subtree rooted at A[i].a)(2p + 1) n, A[2p + 1] > A[2p]b)(2p + 1) n, A[2p + 1] c)(2p + 1) n, A[2p + 1] d)(2p + 1) n, A[2p + 1] Correct answer is option 'B'. Can you explain this answer? for GATE 2024 is part of GATE preparation. The Question and answers have been prepared
according to
the GATE exam syllabus. Information about Consider the following “Max-heapify” algorithm.Array has size at least n and 1in.After applying The Max-heapify noded at A[i], the result will be the subtree of A[1,….n] rooted at A[i] is a max-heapify.{ Assume that except root A[i], all its children satisfies heap property]Max –heapify (int A[ ], int n,int i){ int p,m;p = i;while (2pn){if(Y && Z)m = 2p+1;else m =2p;if(A[p][swap (A[p],A[m]);p=m;}elsereturn ;}}Find missing statements at Y and Z respectively to apply the heapify for subtree rooted at A[i].a)(2p + 1) n, A[2p + 1] > A[2p]b)(2p + 1) n, A[2p + 1] c)(2p + 1) n, A[2p + 1] d)(2p + 1) n, A[2p + 1] Correct answer is option 'B'. Can you explain this answer? covers all topics & solutions for GATE 2024 Exam.
Find important definitions, questions, meanings, examples, exercises and tests below for Consider the following “Max-heapify” algorithm.Array has size at least n and 1in.After applying The Max-heapify noded at A[i], the result will be the subtree of A[1,….n] rooted at A[i] is a max-heapify.{ Assume that except root A[i], all its children satisfies heap property]Max –heapify (int A[ ], int n,int i){ int p,m;p = i;while (2pn){if(Y && Z)m = 2p+1;else m =2p;if(A[p][swap (A[p],A[m]);p=m;}elsereturn ;}}Find missing statements at Y and Z respectively to apply the heapify for subtree rooted at A[i].a)(2p + 1) n, A[2p + 1] > A[2p]b)(2p + 1) n, A[2p + 1] c)(2p + 1) n, A[2p + 1] d)(2p + 1) n, A[2p + 1] Correct answer is option 'B'. Can you explain this answer?.
Solutions for Consider the following “Max-heapify” algorithm.Array has size at least n and 1in.After applying The Max-heapify noded at A[i], the result will be the subtree of A[1,….n] rooted at A[i] is a max-heapify.{ Assume that except root A[i], all its children satisfies heap property]Max –heapify (int A[ ], int n,int i){ int p,m;p = i;while (2pn){if(Y && Z)m = 2p+1;else m =2p;if(A[p][swap (A[p],A[m]);p=m;}elsereturn ;}}Find missing statements at Y and Z respectively to apply the heapify for subtree rooted at A[i].a)(2p + 1) n, A[2p + 1] > A[2p]b)(2p + 1) n, A[2p + 1] c)(2p + 1) n, A[2p + 1] d)(2p + 1) n, A[2p + 1] Correct answer is option 'B'. Can you explain this answer? in English & in Hindi are available as part of our courses for GATE.
Download more important topics, notes, lectures and mock test series for GATE Exam by signing up for free.
Here you can find the meaning of Consider the following “Max-heapify” algorithm.Array has size at least n and 1in.After applying The Max-heapify noded at A[i], the result will be the subtree of A[1,….n] rooted at A[i] is a max-heapify.{ Assume that except root A[i], all its children satisfies heap property]Max –heapify (int A[ ], int n,int i){ int p,m;p = i;while (2pn){if(Y && Z)m = 2p+1;else m =2p;if(A[p][swap (A[p],A[m]);p=m;}elsereturn ;}}Find missing statements at Y and Z respectively to apply the heapify for subtree rooted at A[i].a)(2p + 1) n, A[2p + 1] > A[2p]b)(2p + 1) n, A[2p + 1] c)(2p + 1) n, A[2p + 1] d)(2p + 1) n, A[2p + 1] Correct answer is option 'B'. Can you explain this answer? defined & explained in the simplest way possible. Besides giving the explanation of
Consider the following “Max-heapify” algorithm.Array has size at least n and 1in.After applying The Max-heapify noded at A[i], the result will be the subtree of A[1,….n] rooted at A[i] is a max-heapify.{ Assume that except root A[i], all its children satisfies heap property]Max –heapify (int A[ ], int n,int i){ int p,m;p = i;while (2pn){if(Y && Z)m = 2p+1;else m =2p;if(A[p][swap (A[p],A[m]);p=m;}elsereturn ;}}Find missing statements at Y and Z respectively to apply the heapify for subtree rooted at A[i].a)(2p + 1) n, A[2p + 1] > A[2p]b)(2p + 1) n, A[2p + 1] c)(2p + 1) n, A[2p + 1] d)(2p + 1) n, A[2p + 1] Correct answer is option 'B'. Can you explain this answer?, a detailed solution for Consider the following “Max-heapify” algorithm.Array has size at least n and 1in.After applying The Max-heapify noded at A[i], the result will be the subtree of A[1,….n] rooted at A[i] is a max-heapify.{ Assume that except root A[i], all its children satisfies heap property]Max –heapify (int A[ ], int n,int i){ int p,m;p = i;while (2pn){if(Y && Z)m = 2p+1;else m =2p;if(A[p][swap (A[p],A[m]);p=m;}elsereturn ;}}Find missing statements at Y and Z respectively to apply the heapify for subtree rooted at A[i].a)(2p + 1) n, A[2p + 1] > A[2p]b)(2p + 1) n, A[2p + 1] c)(2p + 1) n, A[2p + 1] d)(2p + 1) n, A[2p + 1] Correct answer is option 'B'. Can you explain this answer? has been provided alongside types of Consider the following “Max-heapify” algorithm.Array has size at least n and 1in.After applying The Max-heapify noded at A[i], the result will be the subtree of A[1,….n] rooted at A[i] is a max-heapify.{ Assume that except root A[i], all its children satisfies heap property]Max –heapify (int A[ ], int n,int i){ int p,m;p = i;while (2pn){if(Y && Z)m = 2p+1;else m =2p;if(A[p][swap (A[p],A[m]);p=m;}elsereturn ;}}Find missing statements at Y and Z respectively to apply the heapify for subtree rooted at A[i].a)(2p + 1) n, A[2p + 1] > A[2p]b)(2p + 1) n, A[2p + 1] c)(2p + 1) n, A[2p + 1] d)(2p + 1) n, A[2p + 1] Correct answer is option 'B'. Can you explain this answer? theory, EduRev gives you an
ample number of questions to practice Consider the following “Max-heapify” algorithm.Array has size at least n and 1in.After applying The Max-heapify noded at A[i], the result will be the subtree of A[1,….n] rooted at A[i] is a max-heapify.{ Assume that except root A[i], all its children satisfies heap property]Max –heapify (int A[ ], int n,int i){ int p,m;p = i;while (2pn){if(Y && Z)m = 2p+1;else m =2p;if(A[p][swap (A[p],A[m]);p=m;}elsereturn ;}}Find missing statements at Y and Z respectively to apply the heapify for subtree rooted at A[i].a)(2p + 1) n, A[2p + 1] > A[2p]b)(2p + 1) n, A[2p + 1] c)(2p + 1) n, A[2p + 1] d)(2p + 1) n, A[2p + 1] Correct answer is option 'B'. Can you explain this answer? tests, examples and also practice GATE tests.