Algorithms and Data Structures · Senior · Question 45 of 75
Why are tries often replaced by hash maps or radix trees in production?
- 1Tries can't store words with non-ASCII characters
- 2Tries are O(n²) for every lookup
- ✓Correct answer: Plain tries waste memory on nodes with a single child
Explanation
A node per character with child maps is heavy. Radix (Patricia) trees compress chains of single children into one edge. Routers in web frameworks (find-my-way in Fastify) use radix trees for URL matching.