Question: Study the following Linear search algorithm and answer the questions that follow: def linearSearch (1s, data): for item in 1s: if item == data:
Study the following Linear search algorithm and answer the questions that follow: def linearSearch (1s, data): for item in 1s: if item == data: return True return False myArray=[6,3,9,5,8,2] print(linearSearch (myArray, 9)) 1. Count the number of operation in the Linear Search algorithm for n-10 and n=100 2. Write down an equation for the number of operations as a function of the size of the array or n.
Step by Step Solution
3.26 Rating (149 Votes )
There are 3 Steps involved in it
Question 1 Count the number of operations in the Linear Search algorithm for n10 and n100 Solution For n10the Linear Search algorithm will perform the ... View full answer
Get step-by-step solutions from verified subject matter experts
