Question: makea 100,000-element array of randomintegers named data1 and make two additional copies of the array (data2 and data3) bycalling method copy on the original array.

makea 100,000-element array of randomintegers named data1 and make two additional copies of the array (data2 and data3) bycalling method copy on the original array.

Next, use%timeitas follows to compare theperformance of each sorting algorithm:

%timeit -n 1 -r 1selectionsort.selection_sort(data1)

%timeit -n 1 -r 1insertionsort.insertion_sort(data2)

%timeit -n 1 -r 1 mergesort.merge_sort(data3)

Do the selection_sort and insertion_sort take approximately the same amount oftime? Is merge_sort much faster?

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock

To create a 100000element array of random integers named data1 and make two additional copies of the ... View full answer

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