complexitystringstrees
When is a trie worth the extra nodes?
Anonymous
A trie can share prefix paths across words, so prefix lookup takes time proportional to the prefix length when each child lookup is constant time. The trade-off is memory: nodes store child links. For exact lookup without prefix queries, a hash set is often simpler.
0