# Linear Search — Sequential Scan (C++)
## Overview
Linear (sequential) search scans elements one-by-one until it finds the target. It's the simplest search strategy, used when the list is unsorted or tiny.
## Complexity
- Time: **O(n)**
- Space: **O(1)**
## Repo reference
`https://github.com/mashrur-rahman-fahim/algorithm/blob/main/linear.cpp` contains a short demonstration that reads 5 numbers and searches for a given target.
## When to use
- Small datasets or unsorted containers.
- When search frequency is low — otherwise maintain a sorted structure or index.
## Example snippet
```cpp\nfor (int i = 0; i < a.size(); ++i) if (a[i]== target) { cout << "found"; return; } cout << "not found";\n```
## Source
`https: //github.com/mashrur-rahman-fahim/algorithm/blob/main/linear.cpp`.