Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Data Structure in C++ using namespace std; Use the following class definition, supplying definitions for the the various methods. class ordered_array { public: /* constructor
Data Structure in C++
using namespace std;
Use the following class definition, supplying definitions for the the various methods.
class ordered_array { public: /* constructor Construct a new ordered_array with the given capacity (maximum size). */ ordered_array(int cap); // destructor ~ordered_array(); /* size() Returns the size (number of elements in the array). */ int size(); /* capacity() Returns the maximum size of the array. */ int capacity(); /* insert(e) Insert e into the array. If size() == capacity() then this does nothing. Note that it is OK to insert duplicates! */ void insert(int elem); /* remove(e) Remove e from the array, if it exists. (If it does not exist, the array should be unchanged.) If multiple copies of e are present, only one should be removed. */ void remove(int elem); /* exists(e) Returns true if e is present at least once in the array. */ bool exists(int elem); /* begin() Return a pointer to the first element of the array. */ int* begin(); /* end() Returns a pointer to one-past-the-end (last + 1) element of the array. */ int* end(); // Private members as needed }
Please check your code throught http://staffwww.fullcoll.edu/aclifton/cs133/files/assign1_test.cpp this code. Thank you.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started