+1 vote
in Data Structures & Algorithms I by (88.2k points)
What traversal over trie gives the lexicographical sorting of the set of the strings?

(a) postorder

(b) preorders

(c) inorder

(d) level order

I need to ask this question from Trie in chapter Trie of Data Structures & Algorithms I

This question was posed to me in homework.

1 Answer

+1 vote
by (737k points)
selected by
Best 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.

Related questions

Welcome to TalkJarvis QnA, a question-answer community website for the people by the people. On TalkJarvis QnA you can ask your doubts, curiosity, questions and whatever going in your mind either related to studies or others. Experts and people from different fields will answer.