Question: Write a function called searchOrSort() that runs and times the following two experiments: 1. Create a random list of 1000 elements, and do 10000 linear

Write a function called searchOrSort() that runs and times the following two experiments: 1. Create a random list of 1000 elements, and do 10000 linear searches on it. 2. Create a random list of 1000 elements, sort it once, and do 10000 binary searches on it. 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? Sample output: Searching an unsorted list of 1000 items 10000 times took: _____________ seconds Sorting then searching a list of 1000 items 10000 times took: _____________ seconds

code in python3 pls

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!