Question: 3 sorting means splitting it up into 3 subarrays. Like wise 2 sorting means splitting it up into 2 subarrays (b) (12 points) Assume an

 3 sorting means splitting it up into 3 subarrays. Like wise

3 sorting means splitting it up into 3 subarrays. Like wise 2 sorting means splitting it up into 2 subarrays

(b) (12 points) Assume an implementation of Shell sort that uses data swaps when it performs k-sorting based on insertion sort. In the worst case, insertion sort requires about m/2 data swaps to sort an array of m elements. Here, we show the coefficient (1/2) of the highest order term (m). Consider a sequence of {1,2,3} for Shell-sorting an array of n elements. We perform 3-sorting, 2-sorting, and 1-sorting successively. What are the number of data swaps required, in terms of n, for (i) 3-sorting, (ii) 2-sorting, and (i) 1-sorting in the worst case? You must provide the highest order term and its coefficient. Justify your answers. For example, you may state how the original array should look like and how that allows you to derive your answer(s). ANS: (i) (ii) (b) (12 points) Assume an implementation of Shell sort that uses data swaps when it performs k-sorting based on insertion sort. In the worst case, insertion sort requires about m/2 data swaps to sort an array of m elements. Here, we show the coefficient (1/2) of the highest order term (m). Consider a sequence of {1,2,3} for Shell-sorting an array of n elements. We perform 3-sorting, 2-sorting, and 1-sorting successively. What are the number of data swaps required, in terms of n, for (i) 3-sorting, (ii) 2-sorting, and (i) 1-sorting in the worst case? You must provide the highest order term and its coefficient. Justify your answers. For example, you may state how the original array should look like and how that allows you to derive your answer(s). ANS: (i) (ii)

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!