Linear Search

This algorithm is used for Strings and Lists often.
index()andfind()are linear searchesinandnot inmembership for strings and lists are linear searches
Algorithm Classification
Big-O: O(n) hence the name “Linear” Search … happens when the target is not found -or- target is the last value
Big-Omega: O(1) very first item is the target
Big-Theta: O(n/2) which simplifies to O(n) … target is found somewhere in the middle
Linear Search Algorithm:
Note on using a while loop
Last updated