Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

3. 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 heap sort on that combined list.

UNHMergeSort(array A)

{

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

else

{

split A into Left and Right

UNHMergeSort(Left)

UNHMergeSort(Right)

Do Heap 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 UNHmergesort.

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

Question is from algorithm design and analysis course

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

Step: 3

blur-text-image

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

Advanced Database Systems

Authors: Carlo Zaniolo, Stefano Ceri, Christos Faloutsos, Richard T. Snodgrass, V.S. Subrahmanian, Roberto Zicari

1st Edition

155860443X, 978-1558604438

More Books

Students also viewed these Databases questions

Question

Explain the causes of indiscipline.

Answered: 1 week ago