Question: Question 1 : Linear search ( worst case i s ( N ) , b e s t c a s e i s (
Question : Linear search worst case
According to chatGPT: Searching for a key in a dataset with a billion entries is not uncommon, especially in largescale
databases, distributed systems, or when dealing with big data. The efficiency of searching in such large datasets depends on the
data structure and algorithm used.
def searchlDList theList number:
# complete your code to find the position of a key in the list
return "Not found
# Use the main testdriver
import time
import tumpry as np
import random
npxandomseed
theSize # generate one billion numbers
tandomNumber Enp,random,randint sizetheSize
printtandonNumber
print size of the list:", lentandomNumber
printrandomNumbertheSize # print the last int in the list
starttimetime
answer, possearchDListrandomNumber search for a non existent key worst case
finishtimetime
print answer at position pos
print time is: strfinishstart seconds"
Output:
dots
size of the list :
Not found at position
time is: seconds
Complete the following table and make your conclusion, please include the code you've used for each one along with the outputs.
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
