Question: Using C++, design and implement a class called DynList that stores data from the user in the form of a dynamic array of doubly linked

Using C++, design and implement a class called DynList that stores data from the user in the form of a dynamic array of doubly linked lists as illustrated in gure 1 below. We will limit the data that we deal with to integers. Users should be able to specify custom ranges of data that will go into the respective list. In the gure, each array index represents a particular range. Obviously, there cannot be a duplicate range. For example, index 4 cannot have a range of 3-8. Absolutely no global variables anywhere in your code! Implement the following:

(a) Constructors and a destructor.

(b) Overloaded copy constructor.

(c) Overloaded assignment operator.

(d) Overloaded == operator to check if two objects of DynList are the equal. Two DynList objects are equal if they have the same ranges in the dynamic array and each list has the same contents. The order of the ranges in the array does not matter. The order of the contents in the list does not matter.

(e) Add a new range (e.g. 45-52): there should not be any duplicate or overlap of the ranges in the object.

(f) Remove a range (e.g. 10-19): deletes all list elements.

(g) Merge ranges (e.g. 0-19): should merge the corresponding lists.

(h) Remove an element (e.g. 95): removes only one occurrence.

(i) Insert before (e.g. insert 22 before 23). Should succeed only if the range is present and inserting will be consistent.

(j) Remove duplicates: removes duplicates globally from all lists.

(k) Display all data.

Use const keyword wherever appropriate. Write a modular main function (that is, with functions) to demonstrate all the features. The main function does not need to interact with the user (i.e. get input from the user using cin). Simply demonstrate all the features using sample data.

Using C++, design and implement a class called DynList that stores data

Doubly linked list NULL 0-9 NULL 15 NULL 10-19 NULL 95 95 NULL 91-100 NULL 21 23 21 Dynamic array NULL 21-23 NULL Each list above stores a value of a user defined range. New ranges can be added dynamically. Figure 1: Dynamic array of doubly linked lists Doubly linked list NULL 0-9 NULL 15 NULL 10-19 NULL 95 95 NULL 91-100 NULL 21 23 21 Dynamic array NULL 21-23 NULL Each list above stores a value of a user defined range. New ranges can be added dynamically. Figure 1: Dynamic array of doubly linked lists

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!