viewing paste Unknown #27592 | Text

Posted on the
1 2 3 4 5 6 7 8 9
A linear search algorithm is written (as in the modules, for example) which searches an array for some user-defined value, clientData.  If clientData is stored in the array, it returns its array position, and if not found, it returns -1 (again, just like in the modules).  Assume the array to be searched has 100 data elements in it.   (Check all that apply):
 
[NOTE: due to common off-by-one interpretations when counting such things, if your predicted answer is within one (+1 or -1) of a posted option below, you can assume your prediction and the choice you are looking at are equivalent and check that option.]
 
        A.      It may require as many as 100 comparisons of data before it returns.
        B.      It will always return with an answer in 10 or fewer comparisons of data.
        C.      It will never require more than 100 comparisons of data before it returns.
        D.      It might return to the client with an answer after only one comparison of data.
        E.      It will always return with an answer in 50 or fewer comparisons of data.
Viewed 435 times, submitted by unknown.