1.

What traversal over trie gives the lexicographical sorting of the set of the strings?(a) postorder(b) preorders(c) inorder(d) level orderI need to ask this question from Trie in chapter Trie of Data Structures & Algorithms IThis question was posed to me in homework.

Answer» CORRECT option is (c) inorder

Easy explanation - In trie, we store the strings in such a way that there is ONE node for EVERY COMMON prefix. Therefore the inorder traversal over trie gives the lexicographically sorted SET of strings.


Discussion

No Comment Found

Related InterviewSolutions