Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Implement Heap Sort. Write a main() function in C++ to enter a sequence of integ

ID: 3679460 • Letter: I

Question

Implement Heap Sort. Write a main() function in C++ to enter a sequence of integers, until end-of-file, and call your sort function to sort and then print the sorted sequence. Next input a sequence of strings, until end-of-file, and call the same sort function to sort (in alphabetical order) and print the result.
Hand in a printout of your program, the two input files, and the typescript of program execution and output.

Explanation / Answer

using namespace std; int main() { ifstream iff("input.txt"); int n; iff>>n;//n=10 int arr[n]; for(int i=0;iff>>n;i++) ar[i]=n; void makeheaphere( int [ ], int ) ; void heapsort ( int [ ], int ) ; printf ( "Heap Sort. " ) ; makeheaphere ( arr, 10 ) ; printf ( " This is the array Before Sorting: " ) ; for ( i = 0 ; i x[1] ) s = 2 ; while ( s >= 0 && ivalue
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote