Resource · Guide or article
Linear Search
Basic definition of linear search: checking each element in order until a match or the end of the list. Suits absolute beginners.
Reviewed
Open the original: Linear Search (opens the original site in a new tab)Add to a roadmap
Keep this resource with a roadmap you follow. It appears as your own extra resource; the roadmap's steps don't change and it doesn't count toward your tracked steps.
Source content: English
Read this in other languages: Português brasileiro. In computer science, linear search or sequential search is a method for finding a target value within a list. It sequentially checks each element of the list for the target value until a match is found or until all the elements have been searched. Linear search runs in at worst linear time and makes at most n comparisons, where n is the length of the list. Time Complexity: O(n) - since in worst case we're checking each element exactly once.
PrepKit overview
PrepKit editors wrote and reviewed this overview from the source repository. It is not text from the resource itself.
- Suited to
- The source does not state a level
- Format
- Reference
What it covers
- Sequential scan with at most n comparisons.
- Time complexity O(n), with a one-line justification.
How to use it
PrepKit study advice, not a claim made by the source.
Code it, return -1 when the target is missing, and explain aloud when a linear scan beats sorting first.
Scope and limitations
Very thin, with no variants or exercises; external links to Wikipedia, TutorialsPoint, and YouTube. A Portuguese version is linked.
Access and format
English README on GitHub; free; from the MIT-licensed trekhleb/javascript-algorithms repo.
Reviewed by PrepKit on Oct 2, 2026. Listing source commit: 85293e3e2b88
Evidence behind this overview
- src/algorithms/search/linear-search/README.md
Pages that include this
Get the PrepKit newsletter
Optional. You don't need it to use PrepKit.