Question: Consider the following 3 - way merge sort algorithm that takes input S , a sequence of n elements, where n = 3 m

Consider the following "3-way merge sort" algorithm that takes input
S , a sequence of n elements, where n=3m(i.e., n is a power of 3) and
Merge 3 is a procedure that takes 3 sorted lists and merges them into
a sorted list.
Merge3Sort (A, n)
{ if (n >1)
{ A1\leftarrow leftmost n/3 items of A;
A2}\leftarrow\mathrm{ middle n/3 items of A;
A3\leftarrow rightmost n/3 items of A;
Merge3Sort (A1, n/3);
Merge3Sort (A2, n/3);
Merge3Sort (A3, n/3);
Merge3(A1, A2, A3);
}
}
Describe (do not write code) an algorithm for Merge3, the 3way-
merge procedure that takes three sorted lists and merge them into a
single sorted list.
What is the complexity of your Merge3, the 3way-merge
algorithm? Express it in terms of big-O notation.
Write the recurrence relation that describes the complexity of the
3-mergesort.
Consider the following " 3 - way merge sort"

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!