I AM CODING IN C++. We combine two sorting algorithms, insertion-sort and merge-
ID: 3883285 • Letter: I
Question
I AM CODING IN C++.
We combine two sorting algorithms, insertion-sort and merge-sort, as follows: when the input size is less than 100, we use insertion-sort: otherwise, we use merge-sort. More specifically, we replace line 1 in Merge-Sort (page 34) with "if r - p > = 100", and add line 6 "else lnsertion-Sort(A, p, r)". Insertion-Sort(A, p, r) implies performing insertion sort on the subarray A|p middot middot middot r|. In this lab assignment you will implement this hybrid sorting algorithm.Explanation / Answer
public class MergeSort { /* Merge Sort function */ public static void sort(int[] a, int low, int high) { int N = high - low; if (NRelated Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.