Starting from:

$31

CPE212- Project05  Solved

 


                                                              


<Project05 Description 
For this project, you will write a multi-file C++ program that implements and tests a Smart Heap class template.  In this version of the SmartHeap datatype you will store members of the heap in a one-dimensional array that is dynamically allocated by the class constructor.  The first two input files allow you to test your class template using integers.  The last two input files allow you to test your class template using objects of type Task.   







<Project05 SmartHeap Class Description 
The SmartHeap class uses a dynamically allocated one dimensional array to store heap values.  When this array is filled to capacity, the next insert causes creation of a new array with twice the capacity.  Values from the smaller array are copied from the small array into the new larger array, and then the smaller array is deallocated to prevent a memory leak.   

When deleting the maximum value, the process of expanding the array is reversed.  When the amount of data stored within the smart heap array dwindles to less than half of the current array capacity, you must resize the array without losing any data or creating a memory leak.  When resizing the array, cut the capacity in half.  However, be sure that you do not to shrink the array below the minimum array size of DEFAULTSIZE. 

 

The data type of the value stored in each node is determined by the client code main.cpp. è Inline functions are not allowed in this course and will result in no credit (0) ç 

[Note: An inline function is a function whose definition appears within the class declaration] 

The SmartHeap class contains three private attributes, six private functions, and eight public member functions 

è See the file smartheap.h for additional details regarding the function interfaces ç 

 

<Project05 Hints 
Sample codes for the array implementation of the Heap container appear in Chapter 9 of the official course textbook,  

C++ Plus Data Structures, Sixth edition  by Nell Dale, Chip Weems, and Tim Richards 

More products