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
Step: 1
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...Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started