Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Please write the remove output and creat array program in python Implement this in another notebook and document it. IK SELECTION I1.16 (Timing Sorting Algorithms)

Please write the remove output and creat array program in python

Implement this in another notebook and document it.

IKimage text in transcribed

SELECTION

image text in transcribedimage text in transcribedimage text in transcribed

I1.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 data1 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(data1) \%timeit -n 1 -r 1 insertionsort.insertion_sort(data2) \%timeit -n 1 -r 1 mergesort.merge_sort(data3) Do the selection_sort and insertion_sort take approximately the same amount of time? Is merge_sort much faster? 450 Computer Science Thinking: Recursion, Searching, Sorting and Big O

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access with AI-Powered 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

Students also viewed these Databases questions