CPKit
v1.6.1

Linear Search

SearchingEasy

Scan array elements sequentially to locate match values.

Alt+Shift+L

Configuration Panel

Sequential Sweep Pointer Index Highlight

5
0
8
1
12
2
16
3
23
4
38
5
56
6
72
7

Time Complexity

O(N) linear sweep

Space Complexity

O(1) auxiliary variables
Conceptual Overview

Linear Search checks each element of the array sequentially from start to end until a match is found or the array is exhausted.

Algorithm Idea

Initialize index pointer at 0. Increment pointer and compare each cell value to the target. Returns index if found, else -1.

Stable Sorting

N/A

In-place Memory

N/A

Source: CP-Algorithms search & sorting reference