AlgoScope

Linear Search

AlgorithmbeginnerSearchingalso called Array Search

Check every slot in order. On average half the array, in the worst case all of it.

Decision · step 2 of 6Array: Linear search, found
501142238435i5 > 2

Index 0 holds 5, not 2. Move on.

Open in the player →or start at step 2

What you will see

One pointer, one comparison per cell; no assumption about order.

How array works →

Cost

BestO(1)
AverageO(n)
WorstO(n)
SpaceO(1)

How you work with it here

play it through, step one change at a time, scrub to any step, run it on your own input, predict what happens next.

Screen readers: Cells announce index, value and state (current, discarded, found); each step announces the comparison and the resulting range.

Reduced motion: Range and pointer changes snap into place with a short crossfade; discarded cells fade without movement.

Before this

Leads to

Topics that need this one first.

Taught by the same lesson

Array covers these too, in the same run.