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, a pointer to the previous student and a pointer to a single linked list that will contain each student’s set of scores. Here is a sample visual. The head points to the beginning of the list. The tail points to the end of the list.
The information for each student will be on a single line in a text file. 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”. Also, notice the scores for each student ends with the word “end”.
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 70 95 end
jill 50 90 80 end
John 65 end
jack 50 35 end
At the end of the program, traverse through the contents of the linked lists 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:
Jack 50 35
Jack 50 35
Assumptions: Names are all in lower case. Names cannot be duplicated.
When deleting, make sure to use deallocate all the spaces. This would be all the scores for the individual from the singly linked list and the individual from the doubly linked list.
There is no user input. Everything is done through the file.
• Code should be modularized.
• Do not use classes. Write the program in C.
• The only global variables should be the file handles.
• The name of your input file should be input.txt.
• The name of your output file should be output.txt.
• The names in the text file may appear in unsorted order but should be inserted into the linked list in sorted order.
• End marks the end of the list of scores for each student.
• Delete, followed by a name, should eliminate that individual, along with his/her scores from the list.
• The list should be written in ascending and descending order, with a line in-between, into the file, output.txt.
This material may consist of step-by-step explanations on how to solve a problem or examples of proper writing, including the use of citations, references, bibliographies, and formatting. This material is made available for the sole purpose of studying and learning - misuse is strictly forbidden.#include <stdio.h>
#define MAX_LENGTH 50
#define MAX_SIZE 500
// Score node
struct Score * next;
typedef struct Score Score;
// Student node
struct Student * next;
struct Student * prev;
char * name;
Score * scorePtr;
typedef struct Student Student;
// double linked list
Student * head;
Student * tail;