Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Please code in C++ In this assignment you will implement a heap data structure that is able to do Heapsort. Implement it in an array.
Please code in C++
In this assignment you will implement a heap data structure that is able to do Heapsort. Implement it in an array. The first line of input will be given in the form of a list of numbers to insert into a binary tree in level order. When finished inserting heapify the tree into a MAXHEAP. Print out the level order traversal for it. Then remove the head (min) and print it out one at a time in order to print the list sorted. Notes: -Comment your source code appropriately. Make sure you name your program file in accordance with the syllabus stipulations Test your program by running with different input to make sure the output is correct. Test and execute your program by using data-in by Linux input redirection. If your executable code is Ast# and your data file is named data# execute as: Ast-c data# Sample Input: 198 543 766 745 62 562 805 654 52 936 207 251 495 701 303 823 460 663 21 314 434 543 465 100 597 567 752 624 565 778 529 Sample output: Heapify Complete: 936 823 805 745 752 778 654 663 434 543 597 567 701 766 195 460 52 21 314 62 207 465 100 251 562 495 624 565 303 529 Sorted List: 21 52 62 100 198 207 251 303 314 434 460 465 495 529 543 543 562 565 567 597 624 654 663 701 745 752 766 778 805 823 936
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started