What is Binary Tree Pre-Order, In-Order, Post-Order traversal?

Cing Sian Dal
1 min readMar 26, 2021

--

In a pre-order traversal, the root node of the tree is processed first, then the left subtree is traversed, then the right subtree.

In a post-order traversal, the left subtree is traversed, then the right subtree, and then the root node is processed.

In an in-order traversal, the left subtree is traversed first, then the root node is processed, then the right subtree is traversed.

Well, it is not meaningful but complexly meaningful.

Watch this video. It will clear its definitions.

Simply,

  • In pre-order traversal, sequence is started at the left free subtree of a node and continued at the left subtree of the rest nodes.
  • In order traversal, sequence is started at the middle of free subtrees of a node and continued at the middle subtree of the rest nodes.
  • In post-order traversal, sequence is started at the right free subtree of a node and continued at the right subtree of the rest nodes.

Read more at http://math.hws.edu/eck/cs124/javanotes5/c9/s4.html

--

--

Cing Sian Dal
Cing Sian Dal

Written by Cing Sian Dal

Don’t follow me. I wrote junks here. Follow me on Twitter instead.

No responses yet