Is BUILD-MAX-HEAP recurrent? Why do we want the loop index i in line 2 of BUILD-MAX-HEAP to decrease from length[A]/2] to 1 rather than increase from 1 to [length[A]/2]? BUILD-MAX-HEAP(A) 1...


Is BUILD-MAX-HEAP recurrent? Why do we want the loop indexi in line 2 of BUILD-MAX-HEAP to decrease from length[A]/2] to 1 rather than increase from 1 to [length[A]/2]?


BUILD-MAX-HEAP(A)
1 heap-size[A] ← length[A]
2 for i ← [length[A]/2] downto 1
3 do MAX-HEAPIFY(A, i )



Jun 06, 2022
SOLUTION.PDF

Get Answer To This Question

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here