Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

image text in transcribed

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

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_2

Step: 3

blur-text-image_3

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

Icdt 88 2nd International Conference On Database Theory Bruges Belgium August 31 September 2 1988 Proceedings Lncs 326

Authors: Marc Gyssens ,Jan Paredaens ,Dirk Van Gucht

1st Edition

3540501711, 978-3540501718

More Books

Students also viewed these Databases questions