a write a non recursive method to sequentially search for an element into a portion 5346327

a. Write a non-recursive method to sequentially search for an element into a portion of an input array. You can use two indices (low and high) as inputs to your method in order to limit the search area within the input array. b. Repeat part (a) using a recursive method. c. Perform simulations to compare the observed performance of your two implementations of sequential search (parts a and b). Use N randomly generated integers to compare the running time of both implementations (you should use the same input for the two methods), where N takes the values: 1000, 5000, 10000, 20000, 30000, 40000 and 50000. Insert these N randomly generated integers into your input array. Then, for every value of N, compute the average time taken to search for an element into the input array. To compute this average, you should randomly generate 10 elements and search for them. Make sure that at least 30% of your generated search elements are already exist in your input array (This represent the successful search cases). This can be achieved by randomly picking elements from the input array itself (i.e. you can generate random array indices and pick the corresponding array elements). Finally, plot the running time for both methods as a function of the input size N. Comment on the results.

"Get 15% discount on your first 3 orders with us"
Use the following coupon

Order Now