Question: Consider the Searching Problem: Input: A sequence of n numbers, A = (a, a2,, an), and a value v. Output: An index i such

Consider the Searching Problem: Input: A sequence of n numbers, A = (a, a2,, an), and a value v. Output: An 

Consider the Searching Problem: Input: A sequence of n numbers, A = (a, a2,, an), and a value v. Output: An index i such that v = A[i] or -1 if v is not a member of A Let Linear Search algorithm solves the searching problem, i.e., finds the index of the element v in the array A or returns -1 if v is not a member of A. I 1. Write the pseudocode of the Linear Search algorithm. 2. Is the number of iterations of Linear Search a polynomial of the input size n? Why, why not? 3. Is Linear Search an efficient algorithm? Why, why not? 4. Write the Python code on PyCharm of Linear Search algorithm. Randomly generate the input data in range [0, 100], calculate the computational time of the algorithm. (Hint: You can use the code scripts for the Labs on Bilgi Learn.) 5. Report the console outputs for n = 10, 100, 1000. For each n value test for the values v {1, 2, ..., 10). Plot the computational time vs the input size n. Comment on the results. 6. Report your Python code scripts.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock

1 Write the pseudocode of the Linear Search ... View full answer

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 Programming Questions!