subject

Instructions Submit your answers and code in Canvas. Do not submit the sample input files, submit only the .hpp and .cpp files (all of them, even if you do not modify the ones we are providing). Please put down your name in comments at the beginning of all the source code files. Include a brief README file explaining your code, especially if you implemented some of the suggestions for extra credits.
Question
Implement Max Heap and HeapSort. In assignment4.zip, we are providing you with the following files: public/ demo. cpp <-main method to try your implementation maxheap. cpp <-implementation of maxheap (only file you need to modify) maxheap. hpp <-header file inputs <-folder with several sample inputs
To compile, run $ g++ -o heapsort demo. cpp maxheap. cpp .To test your implementation with a sample input file, run $ ./heapsort inputs/input. 10.1 This will test a few methods (you need to check the maxheap after each step manually) and run heapsort (the code will check whether the output is sorted automatically).
To test your implementation with all sample files with one command, run time for f in inputs/input. 10*; do echo $f; ./heapsort $f; done The command time will let you know how long it took to run the code. You may want to store the output in a file so that you can look at it carefully: time for f in inputs/input. 10*; do echo $f; ./heapsort $f; done > output Grading If you implement all the methods in maxheap. cpp properly (i. e., the demo works for any sample input), you will get 100. You also have a few opportunities to earn extra credits:
Implement and test additional methods. For example, implement and test deleteMin.

ansver
Answers: 2

Another question on Computers and Technology

question
Computers and Technology, 22.06.2019 07:20
Write a pseudocode solution for each of these problems. 1. design a while loop that lets that user enter a number. the number should be multiplied by 10, and the result stored in a variable named product. the loop should iterate as long as product contains a value less than 100. 2. design a do-while loop that asks the user to enter two numbers. the numbers should be added and the sum displayed. the loop should ask the user whether he or she wishes to perform the operation again. if so, the loop should repeat; otherwise it should terminate. 3. design a for loop that displays the following set of numbers: 0, 10, 20, 30, 40, 50 100. 4. design a nested loop that displays 10 rows of # characters. there should be 15 # characters in each row. 5. convert this for loop to a while loop. declare integer count for count = 1 to 50 display count end for 6. find the error in the following pseudocode. declare boolean finished = false declare integer value, cube while not finished display β€œenter a value to be cubed.” input value; set cube = value ^ 3 display value, β€œ cubed is β€œ, cube end while
Answers: 2
question
Computers and Technology, 23.06.2019 09:30
After you present a proposal, the committee starts asking you questions, some beyond the strict focus of your proposal. they ask questions about implications in other fields and knowledge about other fields. you are asked to redo your proposal. what is most likely missing? breadth of material depth of material clarity of material details of material
Answers: 1
question
Computers and Technology, 24.06.2019 01:30
Suppose a cpu with a write-through, write-allocate cache achieves a cpi of 2. what are the read and write bandwidths (measured by bytes per cycle) between ram and the cache? (assume each miss generates a request for one block.)
Answers: 1
question
Computers and Technology, 24.06.2019 12:00
How can we take picture in this app
Answers: 1
You know the right answer?
Instructions Submit your answers and code in Canvas. Do not submit the sample input files, submit o...
Questions
question
Business, 19.04.2020 15:57
question
Mathematics, 19.04.2020 15:58
question
Mathematics, 19.04.2020 15:58
Questions on the website: 13722360