specification of the search problem we can now formulate specification of our search problem using that data structuregiven an array and integer xfind an integer such that if there is no such that [jis xthen is - otherwisei is any for which [jis the first clause says that if does not occur in the array then should be - and the second says that if it does occur then should be position where it occurs if there is more than one position where occursthen this specification allows you to return any of them for examplethis would be the case if were [ and were thusthe specification is ambiguous hence different algorithms with different behaviours can satisfy the same specification for exampleone algorithm may return the smallest position at which occursand another may return the largest there is nothing wrong with ambiguous specifications in factin practicethey occur quite often simple algorithmlinear search we can conveniently express the simplest possible algorithm in form of pseudocode which reads like englishbut resembles computer program without some of the precision or detail that computer usually requires/this assumes we are given an array of size and key for , , - if [iis equal to xthen we have suitable and can terminate returning if we reach this pointthen is not in and hence we must terminate returning - some aspectssuch as the ellipsis "are potentially ambiguousbut weas human beingsknow exactly what is meantso we do not need to worry about them in programming language such as or javaone would write something that is more precise likefor +if [ = return ireturn - in the case of javathis would be within method of classand more details are neededsuch as the parameter for the method and declaration of the auxiliary variable in the case of this would be within functionand similar missing details are needed in eitherthere would need to be additional code to output the result in suitable format in this caseit is easy to see that the algorithm satisfies the specification (assuming is the correct size of the arraywe just have to observe thatbecause we start counting from zerothe last position of the array is its size minus one if we forget thisand let run from to insteadwe get an incorrect algorithm the practical effect of this mistake is that the execution of this algorithm gives rise to an error when the item to be located in the array is