In-Order Traversal
Learn about the "in-order" traversal and implement it in C#.
We'll cover the following
Introduction
In the “in-order” traversal, the elements are traversed in “left-root-right” order. They are traversed in order. In other words, elements are printed in sorted ascending order with this traversal. First visit the left child, then the root/parent node, and then the right child. Here is a high-level description of the in-order traversal algorithm:
-
Traverse the left-subtree of the
currentNode
recursively by calling theinOrderPrint()
function on it. -
Visit the
currentNode
and print its value. -
Traverse the right-subtree of the
currentNode
recursively by calling theinOrderPrint()
function on it.
Level up your interview prep. Join Educative to access 80+ hands-on prep courses.