Question: Hello, I really need help writing a function that sorts a Linked List using SHELL SORT . It MUST BE SHELL SORTED . PLEASE WRITE

Hello, I really need help writing a function that sorts a Linked List using SHELL SORT. It MUST BE SHELL SORTED. PLEASE WRITE IN C. ONLY C. NO OTHER LANGUAGE. This function is part of a larger project, and I am struggling to write it. I know how to shell sort an array, but I am having trouble doing the same with a linkedlist.

This is the function:

typedef struct _Node { long value; struct _Node *next; } Node;

Node *List_Shellsort(Node *list, double *n_comp)

{

}

*list is the list of nodes that need to be sorted. *list is already full of values (the size of the list varies). ALL THE VALUES IN *list ARE LONG INTS. *n_comp is the number of comparisons made during the shell sorting process. A comparison here is defined to be any comparison that involves the field value in the structure Node. This variable will be assigned a value during the sorting. It is currently zero. I am using a particular gap sequence for this sorting (1,2,3,4,6,9.... this is Pratt's gap sequence). I have already created another function that generates this sequence. You may use your own gap sequence to write this function if that is convenient.

PLEASE HELP ME. THANK U SO MUCH IN ADVANCE!!!

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!