STEM Interactive Visual Learning Program at TEC-Bridge AI
Prefix Tree (Trie) is a tree data structure used for storing and searching strings efficiently by sharing common prefixes.
Key Characteristics:
Applications: Autocomplete, spell checkers, IP routing, and string matching algorithms.
| Operation | Time Complexity | Space Complexity |
|---|---|---|
| Insert | O(m) | O(m) |
| Search | O(m) | O(1) |
| Prefix Search | O(p + n) | O(1) |
| Delete | O(m) | O(1) |
m = word length, p = prefix length, n = words with prefix
Strengths:
Limitations: