Binary Tree Traversals

By | July 14, 2020

Usually, the process of visiting all nodes of a tree is called tree traversal. Each node is processed only once but it may be visited more than once. Linear data structures like LinkedList, Stack or Queue, etc. The elements are visited in sequential order but in Tree structures, there are many different ways.

Tree traversal is like searching the tree except that in traversal the goal is to move through the Tree in a particular order in addition all nodes are processed in the traversal but once search stops when the required node is found.

Classification of Tree Traversal:

PreOrder traversal is defined as follows:

  • Visit the root
  • Traverse the Left Subtree
  • Traverse the Right Subtree

InOrder traversal is defined as follows:

  • Traverse the Left Subtree
  • Visit the root
  • Traverse the Right Subtree

PostOrder traversal is defined as follows: 

  • Traverse the Left Subtree
  • Traverse the Right Subtree
  • Visit the root

You May Also Like:

Introduction to Tree Data Structure
Introduction to Binary Tree
Structure of Binary Trees
Operations and use of Binary Trees

That’s all about Binary Tree Traversals
If you have any feedback or suggestion please feel free to drop in below comment box.

Leave a Reply

Your email address will not be published. Required fields are marked *