Question: Doubly linked list Create a doubly linked list from a file (input.txt). The number of items is unknown. (Delete from head) Prompt the user for

Doubly linked list

Create a doubly linked list from a file (input.txt). The number of items is unknown. (Delete from head) Prompt the user for a node number. Starting from the head, moving forward, go to the node and delete it.(Delete from tail) Prompt the user for another node number. Starting from the tail, moving backward, go to the node and delete it. Write the contents of the modified list into the file (output.txt).

NOTE: The node to be deleted can be the head, the tail or something in the middle. If there is only one node in the list and it is being deleted, then both the head and tail are affected by this.

Example:

Input file

59 22 23 58

Which item do you want to delete from the beginning?

3

Which item do you want to delete end?

2 //the first delete would remove 23 from the list.

//The second delete would remove 22 from the list.

Output file

59 58

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!