Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Concepts Of Database Management

Authors: Philip J. Pratt, Joseph J. Adamski

4th Edition

0619064625, 978-0619064624

More Books

Students also viewed these Databases questions

Question

Explain the difference between a one-tailed and a two-tailed test.

Answered: 1 week ago

Question

Describe effectiveness of reading at night?

Answered: 1 week ago

Question

find all matrices A (a) A = 13 (b) A + A = 213

Answered: 1 week ago