Question: please answer it within 2 hours Shell sort has been proposed in 1959. The algorithm, sometimes known as the diminishing increment sort, is a repeated

please answer it within 2 hours

please answer it within 2 hours Shell sort has been proposed in

Shell sort has been proposed in 1959. The algorithm, sometimes known as the diminishing increment sort, is a repeated application of the insertion sort. The algorithm first sorts the elements far apart from each other and successively reduces the interval between the elements to be sorted. In shell sort, N elements at a specific interval are sorted based on the sequence of = 1 which is gradually decreased. The performance of the shell sort depends on the type of sequence used for a given input array. Figure 1 is the Shell sort code analyze the code based on the data given in the following questions. N NN 21022 void shellsort (int array(), int n) for (int interval=n/2; interval>0; interval=interval/2) for (int i=interval; i=interval && array[j-interval]>temp; j=j-interval) 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 array[- array[j-interval]; } array[j] tempi } } } int main() int data) 1/given data int size = sizeof (data) / sizeof(data[0]); shell Sort (data, size); } Figure 1 (a) The given data is age = {81,94,11,96,12,35,17,95,28,58,41,75,15). Analyze the code given in Figure 1 line by line based on this data to calculate the time complexity. Next, define what is the time complexity to sort the data and what is the case scenario? Provide your answer in Table 1

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!