Question: Implement the class Doubly Linked List to create a list of integers. You need to provide the implementation of the member functions as described in
Implement the class Doubly Linked List to create a list of integers. You need to provide the implementation of the member functions as described in the following. class DList { private: Node * head; public: DList(); // Checks if the list is empty or not bool emptyList(); // Inserts a new node with value ‘newV’ after the node containing value ‘oldV’. If a node with value ‘oldV’ does not exist, inserts the new node at the end. void insert_after(int oldV, int newV); // Deletes the node containing the specified value void deleteNode(int value); // Inserts a new node at the start of the list void insert_begin(int value); // Inserts a new node at the end of the list void insert_end(int value); // Displays the values stored in the list starting from head void traverse(); // Displays the values stored in the list starting from last }; |
Step by Step Solution
3.36 Rating (159 Votes )
There are 3 Steps involved in it
Solution Code include include using namespace std class Node public int data Node next Node prev class DList private Node head public DList head nullp... View full answer
Get step-by-step solutions from verified subject matter experts
