For sequential search, what is the average number of comparisons needed to find a record in a file?
A sequential search starts from the beginning of the file and checks each element one-by-one until the desired element is found. Assuming that the record you are searching for exists in the file exactly once and could be anywhere in the file with equal probability, the average number of comparisons is equal to half the number of records in the file.
However if the record does not exist in the file, you will have to examine every single record in the file before discovering this.
For a list with n items, the best case is when the value is equal to the first element of the list, in which case only one comparison is needed. The worst case is when the value is not in the list (or occurs only once at the end of the list), in which case n comparisons are needed.
Asymptotically, therefore, the worst-case cost and the expected cost of linear search are both O(n)