Given the following complete binary tree:
25
40
35
20 10 15 30
(a) Write this tree as an array, based on the representation we saw in class:
original array:
(b) Heapify the elements of the array into a max-heap. Show the final array after the entire process:
heapified array:
(c) Remove the largest element from your max-heap in part (b). Show the final array after removal and
restoration of the heap property:
final array:
From the array in part (c), remove the largest element again. Show the final array after removal and
restoration of the heap property:
final array: