Trees¶
| Problem | Complexity | Key Pattern |
|---|---|---|
| Invert Tree | O(n) |
Tree transformation — "mirror", "invert", "flip". Any problem |
| Level Order Traversal | O(n) |
BFS on trees — "level order", "zigzag order", "right side view", any |
| Max Depth | O(n) |
Recursive tree measurement — "max depth", "height", "diameter", |
| Trie | O(m) per insert/search/starts_with/delete where m = word length. |
Autocomplete, spell checking, IP routing, prefix matching. ASI relevance: |
| Validate Bst | O(n) |
Constraint propagation through a tree — "validate BST", "check |