02/21/00
COM1100 Winter2000 Yuhong Yin
5
Linear Search algorithm
n// function prototype
n int linearSearch(int list[], int size, int key);
n 
n// function definition
n // this function returns the location of  key in the list
n // -1 is returned if the value is not found
n int linearSearch(int list[], int size, int key) {
n for (int i = 0; i < size; i++ ) {
n if (list[i] == key) return i;
n }
n   return -1;
n }