33.7k views
0 votes
Array A is not a heap. Clearly explain why does above tree not a heap? b) Using build heap procedure discussed in the class, construct the heap data structure from the array A above. Represent your heap in the array A as well as using a binary tree. Clearly show all the steps c) Show how heap sort work in the heap you have constructed in part (b) above. Clearly show all the step in the heap sort

1 Answer

4 votes

Answer:

Sorted Array A { } = { 1, 4, 23, 32, 34, 34, 67, 78, 89, 100 }

Step-by-step explanation:

Binary tree is drawn given that the binary tree do not follow both minimum heap and maximum heap property, therefore, it is not a heap.

See attached picture.

Array A is not a heap. Clearly explain why does above tree not a heap? b) Using build-example-1
Array A is not a heap. Clearly explain why does above tree not a heap? b) Using build-example-2
User Mazing
by
5.5k points