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 13 do MAX-HEAPIFY(A, i )
Already registered? Login
Not Account? Sign up
Enter your email address to reset your password
Back to Login? Click here