Trie (Prefix Tree)

Efficiently store and retrieve keys in a dataset of strings.

ROOT
End of Word
Active
Status: Enter text to start
Speed
1function insert(word):
2 node = root
3 for char in word:
4 if char not in node.children:
5 node.children[char] = new Node()
6 node = node.children[char]
7 node.isEndOfWord = true