Tries (Prefix Trees) — Build & Query a Trie

Insert words one character per edge; shared prefixes share a path. Then walk search / startsWith / autocomplete and watch the traversed path and matching words light up.

step 0

Trie

end-of-word (isEnd) on the walk path matched word

Operation

Press Step to begin.
First we build the trie by inserting each word character by character — words that share a prefix share a path. Then we run the chosen query, walking one edge per character.
Self-contained visualization. search needs the final node to be an end-of-word; startsWith only needs the path to exist; autocomplete walks to the prefix then collects every end-of-word below it. See junior.md and professional.md for why every operation is O(L), independent of the number of words.