In a binary search tree, which of the following traversals would print the numbers in the ascending order?

Category: QuestionsIn a binary search tree, which of the following traversals would print the numbers in the ascending order?
Editor">Editor Staff asked 4 weeks ago

In a binary search tree, which of the following traversals would print the numbers in the ascending order?
 
(a) Level-order traversal
 
(b) Pre-order traversal
 
(c) Post-order traversal
 
(d) In-order traversal
 
I would like to ask this question from Inorder Traversal topic in section Binary Trees of Data Structures & Algorithms I
 
I had been asked this question by my school principal while I was bunking the class.

1 Answers
Editor">Editor Staff answered 4 weeks ago

Right choice is (d) In-order traversal
 
The best I can explain: In a binary search tree, a node’s left child is always lesser than the node and right child is greater than the node, hence an in-order traversal would print them in a non decreasing fashion.