Question: 1) Create a minimize member function for a dynamic sequence container that is implemented using an array. Member variables include the array itself, the size

1) Create a minimize member function for a dynamic sequence container that is implemented using an array. Member variables include the array itself, the size of the array and the current number of items stored in the array. The function should insure that there is no dynamic memory being wasted by empty array elements.

2) Write a function implementation that overloads the == operator of a dynamic sequence container class to test if two object have the same data sets.

3) Write a function implementation that overloads the == operator of a sequence3 container class to test if two object have the same data sets.

4) Write efficient member functions for the following operations (include documentation): a) delete the first element from a dynamic array. b) delete the last element from a dynamic array.

5) Implement the following function. Make sure you have no memory leaks.

size_t reduceEven(double*& olda, const size_t& size)

Precondition: olda is a dynamic array

Postcondition: The array at olda is replaced with a new array that contains ONLY the EVEN indexed values in its most minimal usage of memory. For example, index's 0,2,4, and so on will exist in the new array and 1 and 3 will be discarded. The new array will be about half the size of original. The number of items removed from the array is returned.

6. Implement the following function. Make sure you have no memory leaks.

void append(node*& headptr, const string& s)

Precondition: headptr points to a singularly linked list of nodes where value_type is string.

Postcondition: appends a copy of the string passed as a parameter, into the back of the list

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!