Prefix Search and Autocomplete
Walk the prefix, then enumerate every terminal below it with a DFS.
Result · step 3 of 7Trie: Autocomplete: everything under ca
Letter 'a': follow it.
What you will see
The prefix path lights up; a traversal fans out below it, emitting words.
Cost
| Best | O(L) |
|---|---|
| Average | O(L + results) |
| Worst | O(L + subtree) |
| Space | O(depth) |
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: Text and pattern cells announce index and character; each step announces the aligned positions, the comparison result and the shift.
Reduced motion: The pattern row snaps to its new alignment with a crossfade instead of sliding.
Before this
Taught by the same lesson
Trie covers these too, in the same run.