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

Other questions on the subject: Computers and Technology

image
Computers and Technology, 22.06.2019 05:10, ahoney2233
Suppose we have a byte addressable computer that has a 32-byte cache with 8 bytes per block. the memory address is 8 bits long. the system accesses memory addresses (in hex) in this exact order: 6e, b9, 17, e0, 4e, 4f, 50, 91, a8, ab, ad, 93, and 94. (a) assuming the cache is direct mapped, what memory addresses will be in cache block 2 after the last address has been accessed? (b) assuming the cache is direct mapped, what is the hit ratio for the entire memory reference sequence given, assuming the cache is initially empty? (c) assuming the cache is 2-way set associative with a lru replacement policy, what is the hit ratio?
Answers: 3
image
Computers and Technology, 22.06.2019 14:20, babyrocks7300
Consider a byte-addressable computer with 16mb of main memory, a cache capable of storing a total of 64kb of data and block size of 32 bytes. (a) how many bits in the memory address? (b) how many blocks are in the cache? (c) specify the format of the memory address, including names and sizes, when the cache is: 1. direct-mapped 2. 4-way set associative 3. fully associative
Answers: 2
image
Computers and Technology, 22.06.2019 19:20, ChaosMind
Write a program that reads a file consisting of students’ test scores in the range 0–200. it should then determine the number of students having scores in each of the following ranges: 0–24, 25–49, 50–74, 75–99, 100–124, 125–149, 150–174, and 175–200. output the score ranges and the number of students. (run your program with the following input data: 76, 89, 150, 135, 200, 76, 12, 100, 150, 28, 178, 189, 167, 200, 175, 150, 87, 99, 129, 149, 176, 200, 87, 35, 157, 189.)
Answers: 3
image
Computers and Technology, 23.06.2019 09:30, blake2001
Which of the following tasks is an audio technician most likely to perform while working on a nature documentary? (select all that apply). eliminating potentially distracting background noise adding sound effects making sure the lighting is adequate for a particular scene changing the narration to better match the mood of the documentary
Answers: 3
You know the right answer?
Instructions Submit your answers and code in Canvas. Do not submit the sample input files, submit o...

Questions in other subjects:

Konu
Arts, 29.03.2021 19:20
Konu
Mathematics, 29.03.2021 19:20
Konu
Mathematics, 29.03.2021 19:20
Konu
Chemistry, 29.03.2021 19:30
Konu
Mathematics, 29.03.2021 19:30
Konu
Chemistry, 29.03.2021 19:30