Question: whether we can do n'tI, mnl.COI 3.36 BeterI (n) 2I(n 1)+n+1, ill.L better by dividing the list into more than two parts. It turns out


whether we can do n'tI, mnl.COI 3.36 BeterI (n) 2I(n 1)+n+1, ill.L better by dividing the list into more than two parts. It turns out wed any better, at least in the worst case. In this exercise you will verif mathematically. TriMergeSort, given below, is a variant of Merges the list is split into three equal parts instead of two. For convenience, assm that n 3*, for some nonnegative integer k. ut we can't d act ort, whre 3.37 A very natural question to ask related to MergeSort is wh procedure TriMergeSort(Low,High) recursive Input: Low,High (indices of a global array L[0:n-1], initially Low 0 and Output: sublist I[Low:High] is sorted in nondecreasing order High = n-1 = 3k-1) if High S Low then return endif Third-low +1(High-Low + 1 )/3] TwoThirds Low + 2* L(High-Low TriMergeSort(Low,Third) TriMergeSort(Third+ 1,TwoThirds) TriMergeSort(TwoThirds+ 1,High) 1)/3 l/merge sublists L[ Low:Third] and lmerge sublists LILow:TwoThirds and LITwoThirds High end TriMergeSort Merge(Low,Third,TwoThirds) LThird.TwoThirds| of sizes n/3 an n/3 MergetLow,TwoThirds,High) and n's IwoThirds High] of sizes 2n'5 a whether we can do n'tI, mnl.COI 3.36 BeterI (n) 2I(n 1)+n+1, ill.L better by dividing the list into more than two parts. It turns out wed any better, at least in the worst case. In this exercise you will verif mathematically. TriMergeSort, given below, is a variant of Merges the list is split into three equal parts instead of two. For convenience, assm that n 3*, for some nonnegative integer k. ut we can't d act ort, whre 3.37 A very natural question to ask related to MergeSort is wh procedure TriMergeSort(Low,High) recursive Input: Low,High (indices of a global array L[0:n-1], initially Low 0 and Output: sublist I[Low:High] is sorted in nondecreasing order High = n-1 = 3k-1) if High S Low then return endif Third-low +1(High-Low + 1 )/3] TwoThirds Low + 2* L(High-Low TriMergeSort(Low,Third) TriMergeSort(Third+ 1,TwoThirds) TriMergeSort(TwoThirds+ 1,High) 1)/3 l/merge sublists L[ Low:Third] and lmerge sublists LILow:TwoThirds and LITwoThirds High end TriMergeSort Merge(Low,Third,TwoThirds) LThird.TwoThirds| of sizes n/3 an n/3 MergetLow,TwoThirds,High) and n's IwoThirds High] of sizes 2n'5 a
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
