Illustrations of Sequential search:
The two illustrations of calling such function is as shown below:
>> values = [85 70 100 95 80 91];
>> key = 95;
>> seqsearch(values, key)
>> seqsearch(values, 77)
This illustration supposes that the key is found only in one element in the vector. Also, however it works; it is not a very efficient algorithm. When the vector is large, and the key is found in the starting, this still loops through the rest of the vector. The improved version would loop until the key is found or the whole vector has been searched. In another words, a while loop is used instead of a for loop; there are two sections to the condition.