Pre-Order Traversal of Binary Tree | Easy Way To Learn
There are three types of Binary tree traversal algorithm:
- Pre-order traversal
- Post-order traversal
- In-order traversal
In this post we are going to learn how to traverse the binary tree using pre-order traversal technique:
Algorithm/Formula – Root + Left Sub-tree + Right Sub-tree
- Visit the root node first
- From the visited root node, go to left sub-tree and apply the formula again.
- When the left sub-tree is completed visit the right sub-tree and apply the formula again.
This method is well explained in the below video and easy to remember: