Trie is a tree-based data structure, used for efficient retrieval of a key in a large data-set of strings. Unlike a binary search tree, where the node in the tree stores the key associated with that node, the Trie node’s position in a tree defines the key with which it is associated, and the key is only associated with the leaves. It is also known as prefix tree as all descendants of a node have a common prefix of the string associated with that node, and the root is associated with the empty string.
Following are the list of commonly asked Trie interview questions:
- Trie Implementation – C, C++, C++ (Memory Efficient), Java, PythonBeginner
- Longest Common Prefix in a given set of strings (using Trie)Medium
- Lexicographic sorting of a given set of keysMedium
- Find the maximum occurring word in a given set of stringsEasy
- Find first
k
maximum occurring words in a given set of stringsMedium - Find duplicate rows in a binary matrixMedium
- Word Break Problem – Using Trie Data StructureMedium
- Generate a list of possible words from a character matrixHard
- Find all words matching a pattern in the given dictionaryMedium
- Find the shortest unique prefix for every word in an arrayMedium
Thanks for reading.
To share your code in the comments, please use our online compiler that supports C, C++, Java, Python, JavaScript, C#, PHP, and many more popular programming languages.
Like us? Refer us to your friends and support our growth. Happy coding :)