Question: python 11.16 (Timing Sorting Algorithms) Remove the output statements from the functions selection_sort, insertion_sort and merge_sort defined in this chapter, then import each example's source-code

python 11.16 (Timing Sorting Algorithms) Remove the output statements from the functionspython

11.16 (Timing Sorting Algorithms) Remove the output statements from the functions selection_sort, insertion_sort and merge_sort defined in this chapter, then import each example's source-code file into IPython. Create a 100,000-element array of random integers named datal and make two additional copies of the array (data2 and data3) by calling method copy on the original array. Next, use %timeit as follows to compare the performance of each sorting algorithm: %timeit -n 1 -r 1 selectionsort.selection_sort(datal) %timeit -n 1-r 1 insertionsort.insertion_sort(data) %timeit -n 1-r 1 mergesort.merge_sort (data) Exercises 473 Do the selection_sort and insertion_sort take approximately the same amount of time? Is merge_sort much faster

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 Databases Questions!