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

1 Expert Approved Answer
Step: 1 Unlock

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

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 Programming Questions!