Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

All in one JAVA file please. Do not use built-in library for linked lists. Write a program that reads a list of students (first names

All in one JAVA file please. Do not use built-in library for linked lists.

image text in transcribedimage text in transcribed

Write a program that reads a list of students (first names only) from a file. It is possible for the names to be in unsorted order in the file but they have to be placed in sorted order within the linked list. The program should use a doubly linked list. Each node in the doubly linked list should have the student's name, a pointer to the next student, and a pointer to the previous student. Here is a sample visual. The head points to the beginning of the list. The tail points to the end of the list. Address Head X1000X100 Address Prev Net Name X100 NULL | 2001 Addrew Prev Next Name x200 x200 1300 m Address Prev Next Name x300 X200 NULL John Address Tal 1 x2000 1x300 When inserting consider all the following conditions: if(!head) { }else if (strcmp (data, head->name) name) >0){ Jelse { } /o other nodes //smaller than head //larger than tail // somewhere in the middle WA When deleting a student consider all the following conditions: student may be at the head, the tail or in the middle Below, you will find a sample of what the file looks like. Notice the names are in unsorted order but the information placed in the linked list (above visual) is in sorted order. The name of the file should be "input.txt. In the text file, the word delete followed by a name, should delete the node with that specific student's name from the doubly linked list. If the name is not found, then nothing is deleted. (NOTE: The above visual represents only the first three lines from the text file below.) Jim jill John delete jill Bob Jack delete jim At the end of the program, traverse through the contents of the linked list in both ascending and descending order, using the doubly linked list, and write the contents into the file output.txt. For example, given the above list, here is the sample display: Bob Jack John === ===== John Jack Bob Write a program that reads a list of students (first names only) from a file. It is possible for the names to be in unsorted order in the file but they have to be placed in sorted order within the linked list. The program should use a doubly linked list. Each node in the doubly linked list should have the student's name, a pointer to the next student, and a pointer to the previous student. Here is a sample visual. The head points to the beginning of the list. The tail points to the end of the list. Address Head X1000X100 Address Prev Net Name X100 NULL | 2001 Addrew Prev Next Name x200 x200 1300 m Address Prev Next Name x300 X200 NULL John Address Tal 1 x2000 1x300 When inserting consider all the following conditions: if(!head) { }else if (strcmp (data, head->name) name) >0){ Jelse { } /o other nodes //smaller than head //larger than tail // somewhere in the middle WA When deleting a student consider all the following conditions: student may be at the head, the tail or in the middle Below, you will find a sample of what the file looks like. Notice the names are in unsorted order but the information placed in the linked list (above visual) is in sorted order. The name of the file should be "input.txt. In the text file, the word delete followed by a name, should delete the node with that specific student's name from the doubly linked list. If the name is not found, then nothing is deleted. (NOTE: The above visual represents only the first three lines from the text file below.) Jim jill John delete jill Bob Jack delete jim At the end of the program, traverse through the contents of the linked list in both ascending and descending order, using the doubly linked list, and write the contents into the file output.txt. For example, given the above list, here is the sample display: Bob Jack John === ===== John Jack Bob

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

More Books

Students also viewed these Databases questions

Question

=+ What is the role of government in bargaining?

Answered: 1 week ago

Question

=+ Who is the negotiation partner at company level?

Answered: 1 week ago

Question

=+Which associations exist?

Answered: 1 week ago