Skip to content
Learnearn.uk » Home » Linear Search

Linear Search

Linear Search

Linear Search

Linear search, also known as sequential search, is a simple searching algorithm that checks each element of a list in order until a match is found or the entire list has been traversed.

Algorithm Steps

  1. Start at the beginning of the list.
  2. Compare the target value with the current element.
  3. If the target value matches the current element, the search is successful and the position of the element is returned.
  4. If the target value does not match the current element, move to the next element in the list.
  5. Repeat steps 2-4 until a match is found or the end of the list is reached.

Demonstration

Complexity

Pros & Cons

Python Code

Challenges