Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

heapDriver.cpp I included a small driver that exercises some of the methods in ArrayMaxHeap. You should be able to put all these files in a

heapDriver.cppI included a small driver that exercises some of the methods in ArrayMaxHeap. You should be able to put all these files in a project or makefile.HeapInterface.hThis file contains the interface for the ADT Heap. It includes documentation for the Heap operations. Do not make any changes to this file.ArrayMaxHeap.hAs we have done on other assignments, I have combined the ArrayMaxHeap class template definition and the implementation of the methods in the header file. Depending on your test code, you may want to adjust the maximum heap size (DEFAULT_CAPACITY). Do not make any other changes to the class template definition. I have included the implementation for some of the methods in this file (do not make any changes to the existing method implementations). I have also included notes and hints for the methods that you need to implement. You will want to remove these extra comments when your implementation is complete. Note that the code provided uses raw pointers.PrecondViolatedExcep.h and PrecondViolatedExcep.cppThese fies contain the definition and implementation for an exception class used by ArrayMaxHeap. Do not make any changes to these files. Note that PrecondViolatedExcep is a class (not a class template). The provided code is set up to compile the driver and this class separately. You should probably put all these files in a project to ensure that the two .cpp files are both compiled.Program Requirements
  1. Complete the implementation for all methods in the ArrayMaxHeapclass template.
  2. For full credit, your driver must test all methods in ArrayMaxHeap.
  3. For full credit, you should test heaps of at least 2 different data types (for example, a heap of integers and a heap of strings).
  4. As noted in section 17.4 of this chapter, you can sort an array by doing the following. Add code to your driver to try this out.
  • use the explicit-value constructor to copy the contents of the array into a maxheap.
  • remove the largest value from the maxheapand put it back in the array at index itemCount - 1.
  • keep removing the next largest value from the array and put it in the next smaller array index until the maxheap is empty.

Attachments:

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Students also viewed these Programming questions

Question

Discuss two potential problems associated with a cold site.

Answered: 1 week ago

Question

What is meant by planning or define planning?

Answered: 1 week ago

Question

Define span of management or define span of control ?

Answered: 1 week ago

Question

What is meant by formal organisation ?

Answered: 1 week ago

Question

What is meant by staff authority ?

Answered: 1 week ago