In this assignment, you will be required to implement a generic SortedArray Container class. Elements in the SortedArray should be always in the non-decreasing order. Unlike basic C++ arrays that burden the programmer with the task of keeping track of its capacity and utilization, the SortedArray must also provide an interface to the programmer to allow for retrieval of information about the number of elements inside it as well as the maximum number of elements it can store.
Requirements
• SortedArray MUST store elements internally in a C++ array. Please refer to the vector implementation example in the textbook, page 81-82.
• SortedArray MUST be able to store elements of any comparable type that provides operator < and operator =.
• All the elements in the SortedArray should always be in non-decreasing order.
• SortedArray MUST have a no-argument constructor that initializes its internal array to some size. This size MUST NOT is so large as to prevent a calling program to initialize several instances of SortedArray in a single execution. Suggested length values are 16 or 64.
• Every SortedArray instance holding n elements MUST accept insertions as long as the system has enough free memory to dynamically allocate an array of 2n+1 elements at insertion request time, regardless of the initial capacity of its internal array. If the system does not have such free memory, SortedArray MUST report an error message as the result of the insertion request.
• SortedArray MUST implement the full interface specified in the file SortedArray.h
• You MUST NOT change the file SortedArray.h
• You class implementation must be in the file SortedArray.cpp
• You must submit a memo (a single .doc file) with the time complexity analysis of each member function.
• I will provide a program to test your class. Compile and run the program with the class. You should probably write other test program(s) to make sure everything works.
Interface
The interface of SortedArray is provided in the attached SortedArray.h file.
It provides for the following public functionality, all of which can be achieved using an internal array representation for the data.
• SortedArray(): no-argument constructor. Initializes the internal array to some pre-specified size.
• ~SortedArray(): destructor.
• SortedArray(const SortedArray