Tries mind map

Prefix trees for autocomplete and word search.

Core idea: When many strings share prefixes, store the prefix once as a path.

Mnemonic: Share prefix → descend → mark · Cost: O(L) per word · prefix memory

Build: Insert & exact lookup

Signal: Many repeated word and prefix queries share starting characters.

Move: Descend or create one child per character; a terminal flag separates word from prefix.

Examples: Implement Trie, Prefix Search, Replace Words

Branch: Wildcard search

Signal: One query character can match several stored edges.

Move: Follow one child for literals; fan out only at the wildcard and stop dead prefixes early.

Examples: Word Dictionary, Regex Prefix Match, Magic Dictionary

Walk: Grid + trie

Signal: A board contains many target words with shared prefixes.

Move: Advance board DFS and trie state together; prune once no live prefix remains.

Examples: Word Search II, Boggle, Prefix Pruning

Augment: Prefix metadata

Signal: Queries need counts, scores, or best suggestions at every prefix.

Move: Aggregate metadata while inserting so lookup answers directly at the final prefix node.

Examples: Prefix Scores, Autocomplete, Search Suggestions

Every mind map