Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

In mergesort, we need to combine two sorted lists to get one sorted list. We saw how to do this using the procedure merge. Suppose

In mergesort, we need to combine two sorted lists to get one sorted list. We saw how to do this using the procedure merge. Suppose we instead decided to combine the two lists together by first appending the two lists into one list (i.e. the second list is added to the end of the first list) and then running MDD Sort on that combined list, where MDD Sort is the sorting algorithm from HW1.

MergeSort(array A)

{

if A has 0 or 1 elements then return(A) else

{

split A into Left and Right

MergeSort(Left)

MergeSort(Right)

Do MDD Sort on (Right appended to the end of Left).

}

}

You can assume that n, the number of elements in the original array, is a power of 2. You have to do the following:

(a) Give a recurrence relation for the running time of MergeSort.

b) Using the Master theorem, solve this recurrence relation.

Make sure you solve the time complexity. I think it is N^2

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Security

Authors: Alfred Basta, Melissa Zgola

1st Edition

1435453905, 978-1435453906

More Books

Students also viewed these Databases questions