Question: using c++ and please add comment In lab 5 you are going to implement the same methods you have implemented in Lab 4 (single linked

using c++ and please add comment

In lab 5 you are going to implement the same methods you have implemented in Lab 4 (single linked list) but as a doubly linked list version. Remember that each node in a doubly linked list contains the two pointers previous and next, and the dataItem. -- You need to modify the class(es) given in Lab 4 files. The modifications will include the data members (e.g., add previous pointer) and the member functions (e.g., modify the constructors to accept one more parameter for the initial value of the previous pointer.) -- After you modify the class(es), you need to implement the following (for doubly linked list):

class List { public: List(int ignored = 0); List(const List& other); List& operator=(const List& other); ~List();

void insert(const DataType& newDataItem) throw (logic_error); void remove() throw (logic_error); void replace(const DataType& newDataItem) throw (logic_error); void clear();

bool isEmpty() const; bool isFull() const;

void gotoBeginning() throw (logic_error); void gotoEnd() throw (logic_error); bool gotoNext() throw (logic_error); bool gotoPrior() throw (logic_error);

DataType getCursor() const throw (logic_error);

void moveToBeginning () throw (logic_error);

void insertBefore(const DataType& newDataItem) throw (logic_error); void showStructure() const;

private: class ListNode { public: ListNode(const DataType& nodeData, ListNode* nextPtr);

DataType dataItem; ListNode* next; };

ListNode* head; ListNode* cursor;

};

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!