Documentation Index
Fetch the complete documentation index at: https://swe.aboneda.com/llms.txt
Use this file to discover all available pages before exploring further.
Trie (Prefix Tree)
A tree-like data structure used for efficient retrieval of keys in a dataset of strings.Structure
- Each node represents a single character
- The root is empty; paths from root to marked nodes form stored words
- Each node has up to 26 children (for lowercase English letters)
- A boolean flag marks the end of a word
Core Operations
| Operation | Time Complexity |
|---|---|
| Insert | O(m) |
| Search | O(m) |
| Starts With (prefix) | O(m) |
| Delete | O(m) |
Implementation Skeleton
Classic Problems
- Implement Trie
- Word Search II (backtracking + trie)
- Design Add and Search Words
- Replace Words
- Longest Word in Dictionary
- Auto-complete systems
When to Use
- Prefix matching and auto-complete
- Spell checkers and dictionary lookups
- IP routing (longest prefix match)
- Word games (Boggle, Scrabble solvers)
