Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Please use Q1 below to answer Q2 in Python. Use a large data set of your choice and a simple time efficiency program (time taken

Please use Q1 below to answer Q2 in Python. Use a large data set of your choice and a simple time efficiency program (time taken = end time - start time) to test. Thanks!

image text in transcribed

Q1) Although merge sort runs in \Theta(n\lg n)(nlgn) worst-case time and insertion sort runs in \Theta(n^2)(n2) worst-case time, the constant factors in insertion sort can make it faster in practice for small problem sizes on many machines. Thus, it makes sense to coarsen the leaves of the recursion by using insertion sort within merge sort when subproblems become sufficiently small. Consider a modification to merge sort in which n/kn/k sublists of length kk are sorted using insertion sort and then merged using the standard merging mechanism, where kk is a value to be determined 2) Write a code combining both algorithms as described in Q1) to find out the most optimal K minimizing time efficiency of your algorithms using 1 M data set from HW2. You may use the time efficiency program you wrote in the previous home work. Please collect and display some performance data proving your K is the most optimal as shown below: K-5: 11.07 seconds K: 10.55 seconds K+5: 10.59 seconds. Please note that the efficiency data above are all made up by me for this homework purpose only. They are not actual simulation results. Q1) Although merge sort runs in \Theta(n\lg n)(nlgn) worst-case time and insertion sort runs in \Theta(n^2)(n2) worst-case time, the constant factors in insertion sort can make it faster in practice for small problem sizes on many machines. Thus, it makes sense to coarsen the leaves of the recursion by using insertion sort within merge sort when subproblems become sufficiently small. Consider a modification to merge sort in which n/kn/k sublists of length kk are sorted using insertion sort and then merged using the standard merging mechanism, where kk is a value to be determined 2) Write a code combining both algorithms as described in Q1) to find out the most optimal K minimizing time efficiency of your algorithms using 1 M data set from HW2. You may use the time efficiency program you wrote in the previous home work. Please collect and display some performance data proving your K is the most optimal as shown below: K-5: 11.07 seconds K: 10.55 seconds K+5: 10.59 seconds. Please note that the efficiency data above are all made up by me for this homework purpose only. They are not actual simulation results

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 Marketing The New Profit Frontier

Authors: Ed Burnett

1st Edition

0964535629, 978-0964535626

More Books

Students also viewed these Databases questions

Question

List the components of a business model of a business problem.

Answered: 1 week ago