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
Step: 1
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