DEV Community

Rohan Navlakhe
Rohan Navlakhe

Posted on

Data Structure used behind Dictionary apps & Search Engines Auto-Complete Feature

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)