Question: python3 Write python code that generates datapoints as described. There needs to be at least 200 different points for each line. Use sizes like 10000
python3





Write python code that generates datapoints as described. There needs to be at least 200 different points for each line. Use sizes like 10000 Data generation requirements You must use the bubble sort as described on a later slide. You must use the insertion sort as described on a later slide. You need to generate 4 different lines on the same graph: o You have to time the running of bubble sort o You have to time the running of insertion sort o You have to count the number of list visits in bubble sort o You have to count the number of list visits in insertion sort MAKE SURE YOU DON'T TIME THE COUNTING!!! You need 4 different functions Output sample 50 1 6l1y Tl) size of the date Bubble Sort out of order swap adjacent elements if they are there are 2 list accesses in this line for i in range (0, len (alist) - 2): for j in range (0, len (alist) -1): compare alist[j] with alist[j+1]: swap alist[j] and alist[j+1] there are 4 list access in this line http://interactivepython.org/runestone/static/pythonds/SortSearch ThelnsertionSort.html for index in range (1,len (alist)): currentvaluealist[index] position - index while position0 and alist [position-1]currentvalue: alist[position]-alist[position-1] positionposition-1 alist[position]-currentvalue # the list visits that need to be counted are highlighted
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
