How it works
Structure
Each node represents a character, a path from the root spells a prefix, and a flag marks a complete word.
Complexity
Insert and search take O(L) for a word of length L, independent of how many words are stored.
When to use it
Reach for a trie on autocomplete, prefix matching, and word-search problems.