Linear search, also called sequential search, is a method for finding an element within a list by checking each element in sequence until a match is found or the whole list has been searched. It runs in linear time in the worst case, making at most n comparisons on a list of length n, and needs no precondition on how the list is ordered, unlike faster searches such as binary search that require a sorted list.
Facts
Time Complexity
Time Complexity (category) Time Complexity (category) Time ComplexityWorst-case O(n), best-case O(1), average O(n). 1 Connections
In Field
Source Wikipedia: Linear Search
Sources
1. Wikipedia: Linear Search
Wikimedia FoundationLead section
A linear search runs in linear time in the worst case, and makes at most n comparisons, where n is the length of the list.
Article text
A linear search runs in linear time in the worst case, and makes at most n comparisons, where n is the length of the list.
In Group: Sequential and Unstructured Search Algorithms, Introduction
It sequentially checks each element of the list until a match is found or the whole list has been searched.
In Field: Algorithms and Complexity Theory, Lead sentence
linear search or sequential search is a method for finding an element within a list.
View the Source Reader Challenges (0)
No disputes yet. Spotted an error or a better source? Open the first one.
Sign in to dispute this or suggest a correction.