(Solved) : 3 Consider Shell Sort Apply Insertion Sort K Subarrays Columns K 3 K 2 Particular K Say Ar Q44135427 . . .
Shell sort: subarrays .Please showing working out andexplanation. Thank you!
3. Consider Shell sort where we apply insertion sort to k subarrays (or columns) for k= 3 and k= 2. For a particular k, we say that the array is k-sorted if each of the k subarrays, as obtained/defined in the context of Shell sort, is sorted properly. The l-th subarray, with 0 <I<k-1, contains the elements A[l], A[1+k], … assuming that A is the unsorted array, and the starting index is 0. Consider k = 3 and k = 2. Shell sort will sort the array by first applying insertion sort to k=3 subarrays, followed by applying insertion sort to k = 2 subarrays. It turns out that the resulted 2- sorted array is still 3-sorted. In other words, if we subdivide the 2-sorted array into k= 3 subarrays (according to the definition of subarrays in the context of Shell sort), each of the k= 3 subarrays is still sorted. Argue that now, each element in the array is at most one position off its correct position. Show transcribed image text 3. Consider Shell sort where we apply insertion sort to k subarrays (or columns) for k= 3 and k= 2. For a particular k, we say that the array is k-sorted if each of the k subarrays, as obtained/defined in the context of Shell sort, is sorted properly. The l-th subarray, with 0
Expert Answer
Answer to 3. Consider Shell sort where we apply insertion sort to k subarrays (or columns) for k= 3 and k= 2. For a particular k, …
OR