Search⌘ K

In-Order Traversal

Explore how to perform in-order traversal in binary trees to visit nodes in ascending order. Learn the left-root-right recursive approach and see Python code implementation to print sorted tree elements.

Introduction #

In In-order traversal, the elements are traversed in “left-root-right” order so they are traversed in order. In other words, elements are printed in sorted ascending order with this traversal. We 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,

  1. Traverse the left sub-tree of the ‘currentNode’ recursively by calling the ...