C++ data stracture 13
CSC 240
Lab 4
Update the SortedType class so that it will be an unbounded array-based data structure. If the
dynamically allocated array becomes full, then create a new dynamically allocated array that is double
the size of the original array and copy over the items. Keep in mind that if the original size of the data
structure is N, then the newly allocated size will be 2N. If the newly allocated data structure of size 2N
gets full, then the next size will be 4N—from 4N to 8N—from 8N to 16N, etc.
Test your updated class with a driver of your own design.
What is the time complexity of the unbounded potential of the class and why?
How would you change this approach of doubling the size of the array to make it more feasible for
memory allocation? Why do you think this approach is better? What are the drawbacks?