Ever wondered how search engines and dictionary apps suggest the right words as you type? It's all thanks to Trie Data Structure! š
The data structure behind the auto-complete feature is also Trie.
Trie is also called āPrefix Treeā. Trie is best suitable when you want to search Strings based on the prefix string (like we do in the dictionary app, where if we enter āappā it shows us suggestions like āappleā, āapplicationā etc.)
Using Trie we can insert and search for the strings in O(k) time where k is the length of the string we want to insert or search. š
and yes, Trie has been derived from reTRIEval word.
Top comments (0)