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.
Enjoy 24/7 customer support for any queries or concerns you have.
Phone: +1 213 3772458
Email: support@gradeessays.com