Question: Implement algorithm BuildHeap(A). Create an array A of size 7 with the following values: 12, 10, 15, 19, 8, 7, 20. Call BuildHeap(A). Output the
Implement algorithm BuildHeap(A). Create an array A of size 7 with the following values: 12, 10, 15, 19, 8, 7, 20. Call BuildHeap(A). Output the resulting array. (Java Programming)
Algorithm BuildHeap Input: An array A[0..n-1] of key values. Output: An array A[0..n-1] that satisfies the heap property. Procedure BuildHeap() for i <-- n div 2 - 1 downto 0 Heapify(i, n-1)
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
