Question: 6. (12 points) A smart guy Carl thinks it is possible to create a better version of the Merge sorting algorithm by breaking the array
6. (12 points) A smart guy Carl thinks it is possible to create a better version of the Merge sorting algorithm by breaking the array into three pieces (in- stead of two as it was described in class). Of course, this idea came to his min d, after he could come up with an algorithm to merge three sorted ar- rays in linear time. He implemented his algorithm and called the procedure CARL'SMERGE(a[1.. ]. l, r). Supposing a[1.., al 1.r] and ar +1.n] are sorted, CARL'SMERGE merges them into one sorted array in O(n) time. Based on this procedure, Carl has designed his recursive algorithm that follows. Algorithm 2 Carl's version of MergeSort 1: function CARI SSORT(a[L.n) 2: if 1 then 3: 5: 6: CARL SSORT(a[1..I]) CARI,'SSORT(all + ..r) CARL'SMERGE(a[1..n].1.r) S: Estimate the running time of this algorithm. Is this a regular MergeSort? Please, explain your answer lgorithm faster than
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
