Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

image text in transcribed

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

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

Managing Your Information How To Design And Create A Textual Database On Your Microcomputer

Authors: Tenopir, Carol, Lundeen, Gerald

1st Edition

1555700233, 9781555700232

More Books

Students also viewed these Databases questions