Computing Atlas

How Computing Was Built
Sign In
Text size
100%
Theme
Algorithm

Linear Search

Searching Algorithm

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)
Constant Time -- O(1) 1
Time Complexity (category)
Linear Time -- O(n) 1
Time Complexity
Worst-case O(n), best-case O(1), average O(n). 1
Connections

In Field

Source Wikipedia: Linear Search
Sources
1. Wikipedia: Linear Search
Wikimedia Foundation
  • Lead 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
Comments (0)
No comments yet. Be the first to share a thought.
Reader Challenges (0)
No disputes yet. Spotted an error or a better source? Open the first one.