Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

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

Beginning Microsoft SQL Server 2012 Programming

Authors: Paul Atkinson, Robert Vieira

1st Edition

1118102282, 9781118102282

More Books

Students also viewed these Databases questions

Question

3. What information do participants need?

Answered: 1 week ago