Question: 1.Build a doubly linked list given the keyboard inputs or the user provided datafile; 2.Perform a mergesort (in the ascending order of the value) for
1.Build a doubly linked list given the keyboard inputs or the user provided datafile;
2.Perform a mergesort (in the ascending order of the value) for the above linkedlist,
and print the list out to the screen.For comparison purpose, please also print the unsorted linked list.
Your doubly linked list node data structure is defined as in the following:

struct my node nt const value struct my node next truct my node prev A pre-prepared data file example is listed at below: 30 20 50 70 10 Given the file above, your program should build a linked list with 5 nodes Note that 0 indicates the end of the data file and should not be included in the linked list Given the above 5 data your unsorted linked list should look like 30 >50K >10 Your program's implementation must include the following features Your program must be compiled from 3 source files o main. C Handles input and output as well as top-level program logic.) o node h Declares the data structure and function mergesort which sorts a given doubly linked list with the ascending order), and print list, which prints a linked list to the screen o node. C Defines the function mergesort and printlist as declared in node h.) Your node. h file must contain the proper preprocessor directives to prevent multiple inclusion The main function must use scanf function call to read the input data from keybord note that the input redirection can be used to directly read the data from a data file) The number of data (in the data file) s not pre-determined The function merges or t must be declared exactly as follows o return value struct mynode o argument (only one struct mynode which is the head of the given linked list o Note that you must implement the mergesort function by yourselves and cannot use any existing implementation from other library The function p must be declared exactly as follows return valu void o argument (only one struct mynode which is the head of the given linked list
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
