Implement the class Doubly Linked List to create a list of integers. You need to provide the
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 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 }; |
Introduction to Java Programming, Comprehensive Version
ISBN: 978-0133761313
10th Edition
Authors: Y. Daniel Liang