1.

What can be the maximum depth of the trie with n strings and m as the maximum sting the length?(a) log2n(b) log2m(c) n(d) mMy doubt is from Trie in division Trie of Data Structures & Algorithms IThis question was addressed to me at a job interview.

Answer»

The correct choice is (d) m

Best EXPLANATION: In the TRIE, the strings are stored efficiently based on the common prefixes. And trie has maximum fan-out 26 if english alphabets are considered. OWING to this, the maximum depth is equal to the maximum STRING length.



Discussion

No Comment Found

Related InterviewSolutions