Expand description
Trie (prefix tree) for storing and querying strings.
Supports three operations, each O(L) where L is the length of the input:
Trie::insert- add a word to the trieTrie::search- whether a word was previously insertedTrie::starts_with- whether any inserted word has the given prefix
Children are stored in a HashMap<char, TrieNode> for O(1) descent.
Structsยง
- Trie
- Trie data structure.