1.

Which of the following is the efficient data structure for searching words in dictionaries?(a) BST(b) Linked List(c) Balancded BST(d) TrieMy question comes from Trie in chapter Trie of Data Structures & Algorithms IThis question was addressed to me in semester exam.

Answer»

Correct CHOICE is (d) Trie

Easiest explanation - In a BST, as well as in a balanced BST SEARCHING takes time in order of mlogn, where m is the maximum string length and n is the number of strings in TREE. But searching in trie will TAKE O(m) time to search the KEY.



Discussion

No Comment Found

Related InterviewSolutions