AlgoScope

String

Data structurebeginnerLinear Structures

An array of characters, so most string algorithms are array algorithms with characters in the cells.

Decision · step 2 of 6String Matching: Naive, every shift
txtpata✓b✓c✓a✓b✓c×abda✓b✓c✓a✓b✓d×c > d

Shift 0: pattern under "abcabc". 5 agree, then 'c' differs from 'd'. Move on to shift 1.

Open in the player →or start at step 2

What you will see

Characters in cells with indices; immutability shown as copy-on-change.

How string matching works →

Cost

accessO(1)
searchO(n)
concatenateO(n + m)
SpaceO(n)

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, try operations in any order.

Screen readers: Each element is an accessibility element with position, value and state; structural changes are announced per step.

Reduced motion: Elements appear at their destination with a crossfade; no travel longer than the element's own size.

Before this

Taught by the same lesson

String Matching covers these too, in the same run.