Question: Heap-sort pseudo-code is given below. What would happen if we remove line 4 from the pseudocode? HEAPSORT(A) 1 BUILD-MAX-HEAP(A) 2 for i= A.length downto 2
Heap-sort pseudo-code is given below. What would happen if we remove line 4 from the pseudocode? HEAPSORT(A) 1 BUILD-MAX-HEAP(A) 2 for i= A.length downto 2 3 exchange A[1] with A[i] 4 A.heapSize = A.heapSize 1 5 MAX-HEAPIFY(A, 1)
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
