Question: I. Consider the algorithm for sequential search, from page 1-10 of the class notes. In each part of this question we make an assumption about


I. Consider the algorithm for sequential search, from page 1-10 of the class notes. In each part of this question we make an assumption about the probability distribution of the presence and location of x in the array. For each part, compute the expected number of times the comparison "if A[i]-x.. is executed if the given assumptions hold. (a) The item a is in the array. It is equally likely to be in any of the n locations in the array. (b) The probability that a is in the array is 0.5. If it is in the array, it is equally likely to be in any of the n locations in the array
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
