Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Driven Web Sites

Authors: Joline Morrison, Mike Morrison

2nd Edition

? 061906448X, 978-0619064488

More Books

Students also viewed these Databases questions