1.

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 traversalI would like to ask this question from Inorder Traversal topic in section Binary Trees of Data Structures & Algorithms II had been asked this question by my school principal while I was bunking the class.

Answer» 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.


Discussion

No Comment Found

Related InterviewSolutions