Array Traversal
Visit every slot once, in order. Nothing is skipped and nothing is revisited.
Result · step 6 of 7Array: Visit every slot
Index 4 holds 8. Running total 20.
What you will see
One pointer walks the row; each visited cell is marked.
Cost
| Best | O(n) |
|---|---|
| Average | O(n) |
| Worst | O(n) |
| Space | O(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: Each cell is announced as index, value and state; each step's accessibility text states the decision and its effect.
Reduced motion: Swaps and shifts become value crossfades with an outline flash; pointers appear at their destination.
Before this
Leads to
Topics that need this one first.
Taught by the same lesson
Array covers these too, in the same run.