Review sorting a list of strings from last lecture
Searching a list
Sequential search of a list
Searching a List
Searching lists for a given search element is one of the most common tasks performed by computers. If no preconditioning of the list (e.g., the is already sorted), then there is no better algorithm than Sequential Search.
Sequential Search
Sequential Search simply scans the list starting at the beginning until the search element is found or the end of the list is reached. The following program performs a sequential search. A function SequentialSearch() is called which returns the index in the list where the search element occurs, or returns -1 if the search element is not on the list.