II. a. Use a top-down approach to build a heap from the following array. Show the intermediate results after adding each element to the heap. Show how the heap will be stored in the array at the end. 21 17 || 1 50 65 19 90 7 10 2 12 4 70 40 b. Using the resulting heap and it is corresponding array representation from part a, show how the array would look like after the first, second and third iteration of applying heap-sort to the array.

icon
Related questions
Question
II.
a. Use a top-down approach to build a heap from the following array. Show the intermediate
results after adding each element to the heap. Show how the heap will be stored in the
array at the end.
21 17 1
50
65
19
90
7
10 2 12 4
70
40
b. Using the resulting heap and it is corresponding array representation from part a, show how
the array would look like after the first, second and third iteration of applying heap-sort to
the array.
Answer:
Transcribed Image Text:II. a. Use a top-down approach to build a heap from the following array. Show the intermediate results after adding each element to the heap. Show how the heap will be stored in the array at the end. 21 17 1 50 65 19 90 7 10 2 12 4 70 40 b. Using the resulting heap and it is corresponding array representation from part a, show how the array would look like after the first, second and third iteration of applying heap-sort to the array. Answer:
Expert Solution
steps

Step by step

Solved in 3 steps

Blurred answer