Linear search, also known as sequential search, is a straightforward method for finding an element within a data structure, such as an array or list. It involves checking each element sequentially until a match is found or the entire structure has been searched.

Core Characteristics

  • Simple and intuitive search method
  • Does not require the data structure to be sorted
  • Inefficient for large datasets due to its linear time complexity

Key Operations

  • Search() This operation sequentially checks each element in the data structure until the target element is found or the end is reached. This operation is straightforward but can be time-consuming for large datasets.. Complexity: O(n) - Linear time operation

Common Applications

  • Searching in small or unsorted datasets
  • Used in scenarios where simplicity is preferred over efficiency
  • Applicable in educational contexts to demonstrate basic search principles

Sorted?