Sometimes the data is unsorted and you just need to find a value or its first position. Linear search checks each element in turn and works on any array or list. Use it for one-off searches on unsorted data, or when the array is small. If you search the same data many times, sort it once and use binary search, or put it in a HashSet.