Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Problem 5 (15 points) Consider a sorting algorithm that combines merge sort and insertionso algorithm. We still use divide and conquer like merge sort, however

image text in transcribed
Problem 5 (15 points) Consider a sorting algorithm that combines merge sort and insertionso algorithm. We still use divide and conquer like merge sort, however when the number of elements in an array is at most k elements (k is a parameter), we stop dividing the clements as t regular merge sort, instead, we call the insertion sort. Assuming we have defined the following two procedures: insertion-sort(Alp q) which sort the subarray Alp 4 merge(Alp.q.r) which merges the sorted subarray Alp-r) and Ar 1q Try to write the pseudo code for this algorithm: given array Alp-q1 and a parameter ka 1. mentioned above merge-insert(Alp q). k) 2. For an input array of size n, how many times will the insertion be called by the modified merge? In the worst case, what is the total time for these insertion sort? worst case? Justity your answer 3. What is the running time of merge-insert in the

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

Spatial Database Systems Design Implementation And Project Management

Authors: Albert K.W. Yeung, G. Brent Hall

1st Edition

1402053932, 978-1402053931

More Books

Students also viewed these Databases questions

Question

=+from: a) a MNEs perspective? and b) the HRM managers perspective?

Answered: 1 week ago