Question: For arr = [x for x in range(1 < < 10, 0, -1)]: 1) Pass the array to an insertion sort function and record the

For arr = [x for x in range(1<< 10, 0, -1)]:

1) Pass the array to an insertion sort function and record the total number of iterations the inner while loop executes.

2) Pass the array to a merge sort function (not the buggy one) and record the total number of iterations the for loop executes.

3) Change the array to arr = [x for x in range(1<< 12, 0, -1)] and repeat the above two steps. Explain the change in terms of O(n * n) and O(n * lg n).

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!