Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Could anyone help me with this assignment in C++ please. ---------------------UML diagram--------------------- class DCList { struct Node { char c; Node* next; Node* pre; };

Could anyone help me with this assignment in C++ please. ---------------------UML diagram--------------------- class DCList { struct Node { char c; Node* next; Node* pre; }; Node* head; Node* tail; Node* cur; public: DCList() DCList (DCList& rhs) ~DCList() DCList& operator = (DCList& rhs) void clear() int append (char c) int insert (char c) int remove (char c) int next (char &c) int size () int find (char c) bool isEmpty() bool isFull() void print() void reverse() bool operator < (DCList& rhs) bool operator == (DCList& rhs) ------------------------------------------------------------------------------------------------------- Using your knowledge of Circular and Doubly-Linked list algorithms, create a new class combining the two into a new data structure: a Circular, Doubly-Linked List. Call the class DCList and place it in it's own header file,DCList.h. Your class must implement the methods as described in the above UML diagram. The following methods should be included in your class: constructor - initializes pointers in the class to NULL. copy constructor - sets pointers to NULL and calls the overloaded assignment operator. overloaded assignment operator - Destroys an existing list in the target object, and then duplicates the source object's list. overloaded == operator - returns true if both objects have identical lists, false otherwise. overloaded < operator - returns true if the lhs object comes before the rhs object alphabetically, false otherwise. Consider an empty object to come before a non-empty one. destructor - destroys the linked list. clear - destroys the linked list, resetting pointers to NULL. insert - inserts it's argument into the list, maintaining an ascending order. Returns 0 on success, -1 on failure. append - attached it's argument to the end of the list. remove - removes the the first node containing it's argument from the list. Returns 0 on success, -1 on failure. isFull - returns true if the list is full, false otherwise. isEmpty - returns true if the list is empty, false otherwise. print - displays the content of the list to the screen on a single line. Each value is separated by a space. reverse - displays the content of the list to the screen on a single line, but in reverse order. next - displays the "next" value in the list. It does this by advancing the cur pointer and then assigning the node's value to next's reference parameter. Returns 0 on success, -1 on failure. Hints: Re-use methods when you can. For example, have the destructor call clear(), have the copy constructor call operator=.

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

Fundamentals Of Database Systems

Authors: Sham Navathe,Ramez Elmasri

5th Edition

B01FGJTE0Q, 978-0805317558

More Books

Students also viewed these Databases questions

Question

Draw and explain the operation of LVDT for pressure measurement

Answered: 1 week ago