Solution Review: Print In-Order Traversal

Let’s go through the detailed solution review of the challenge given in the previous lesson.

Solution

In in-order traversal, the left child (or left subtree) of a node is visited first, then the node itself, and then finally its right child (or right subtree). This approach is followed recursively for each node in the tree until we reach the leaf node. Refer to the following diagram to better understand the algorithm. The dotted arrow shows the path taken by the algorithm.

Level up your interview prep. Join Educative to access 70+ hands-on prep courses.