Question: Objectives: Tracing the heap sort with Heap using Array 1 . Write a program in C + + to trace and display the steps of

Objectives: Tracing the heap sort with Heap using Array
1. Write a program in C++ to trace and display the steps of Heap sort.
2. Should have at least three files: heap.h, heap.cpp and heapMain.cpp.
Heap sort is the process of two steps:
Transform or creating or rebuilding the given array into a max heap.
Deleting the max heap and sorting array elements at the same time.
You are given a string array in this order:{"D","B","A","C","F","E")
Notes on the sample output:
The tracing text can be placed on the left of the array as long as the display is good spacing and good alignment
Sample Output:
Processes of Heap Sort on a given string array
D B A C F E Original array
F D E C B A Initial rebuild to form a heap
A D E C B F After swapping A and F
E D A C B F rebuild min heap
B D A C E F After swapping B and E
D C A B E F rebuild min heap
B C A D E F After swapping B and D
C B A D E F rebuild min heap
A B C D E F After swapping A and C
B A C D E F rebuild min heap
A B C D E F After swapping A and B
A B C D E F Sorted array

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!