makea 100,000-element array of randomintegers named data1 and make two additional copies of the array (data2 and
Fantastic news! We've Found the answer you've been seeking!
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.
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?
Related Book For
Core Concepts Of Accounting Information Systems
ISBN: 9780470507025
11th Edition
Authors: Nancy A. Bagranoff, Mark G. Simkin, Carolyn Strand Norman
Posted Date: