Question: use python program, thanks More practice) Part 3- To sort or to search unsorted? Write a function called searchorsort that runs and times the following

 use python program, thanks More practice) Part 3- To sort or

use python program, thanks

More practice) Part 3- To sort or to search unsorted? Write a function called searchorsort that runs and times the following two experiments: 1. 2. Create a random list of 1000 elements, and do 10000 linear searches on it. Create a random list of 1000 elements, sort it once, and do 10000 binary searches on Which of these two experiments takes longer? What happens if you only do 100 searches on a list of 1000 elements? What if you do 1000 searches on a list of 1000 elements? Searching an unsorted list of 1000 items 10000 times took: seconds Sorting then searching a list of 1000 items 10000 times took: seconds More practice) Part 4-Gno me So There are many different algorithms available for sorting a list of values. Here's the pseudocode of a sorting algorithm called GnomeSort gnomeSort (lis): index 0 while index is less than len (1is) if index==0 or the item to the left is less than the item at index: increment index else: swap lis [index] with lis[index-1 decrement index Write a function called gnomeSort() that performs this algorithm in python. Test that it correctly sorts any given list of random elements. Once you're sure that it works, apply the same timing exercises to gnomeSort that you applied to bubbleSort and linearSearch in Part 2. Can you guess the complexity (in bigo notation) of the gnomesort algorithm from the results of the timing runs

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!