Question: Write the code in C++.Kindly use the given details Implementation of True Dynamic Array Class Your goal is to implement a generic TrueDynamicArray class. You

Write the code in C++.Kindly use the given details

Implementation of True Dynamic Array Class Your goal is to implement a generic TrueDynamicArray" class. You will need to write three files (TrueDynamicArray.h, TrueDynamicArray.cpp and Q6.cpp). Your implemented class must fully provide the definitions of following class (interface) functions. Please also write down the test code to drive your class implementation.

struct node{ int value; node* next; }; class TrueDynamicArray{ private: // think about the private data members... public: // provide definitions of following functions... TrueDynamicArray();// a default constructor TrueDynamicArray (int size);// a parametrized constructor initializing an Array TrueDynamicArray (int *arr, int size);// initializes the Array with an existing TrueDynamicArray (const TrueDynamicArray &);// copy constructor int getAt(int i);// returns the integer at index [i] void setAt(int i, int val);// set the value at index [i] TrueDynamicArray subArr(int pos, int siz);// returns subArray of siz from pos TrueDynamicArray subArr(int pos);// returns a sub-Array from pos to end void push_back(int a);// adds an element to the end of the array

int pop_back();// removes and returns the last element of the array int insert(int idx, int val);// inserts the value val at idx int erase(int idx, int val);// erases the value val at idx int length();// returns the size of the Array void clear();//clears the contents of the Array int value(int idx);//returns the value at idx void assign(int idx, int val);//assigns the value val to the element at index idx void display();// displays the Array bool isEmpty();// returns true if the Array is empty bool equal(TrueDynamicArray);// should return true if both Arrays are same int sort();// sorts the Array. Returns true if the array is already sorted void reverse():// reverses the contents of the array TrueDynamicArray(); };

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!