Main Page | See live article | Alphabetical index

In-order traversal

The in-order traversal of a Binary Search Tree always results in a sorted ( and that too increasing ) list of elements. In in-order traversal, the left subtree of every node is visited first. So if you take the example of the root, its left subtree will be visited first, then the root will be visited and then its right subtree will be visited.


 print key[G]

The above code recursively in-order traverses the Graph G.