Using Array 10 5 10 12 15 8 2 6 2 9 Oder Draw Initial Heap Tree Structure B Draw Show Step Q37065243

Using array [10,5,10,12,15,8,2,6,2,9] in that oder to:

a)Draw into an initial heap tree structure.

b)Draw and show the steps of how the Max-Heapify works using theheap tree from question 8.a.

Answer:


Solution


a)

2 7 6 3 10 9 5 2 5 3

b)

2 3 6 0 1 5 9 0 5 2 2 9 2 4 3

no need to switch 15, as it is in correct position compared toits children.

2 1.3 3 6 1 15 5 2 5 2 5 2 1 4 8

Same with 12

2 3 8 6 0 1 5 9 10 5 2 3 1 4 8

Same

OR
OR

Leave a Comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.