Tree Traversal



Download
 

Traversal is the method of processing each and every node in the Binary Search Tree exactly once in a systematic manner.
There are three different types of tree traversal.
(1) Preorder Traversal
(2) In order Traversal
(3) Post order Traversal

PreOrder Traversal

Steps for Preorder Traversal:
(1) Process the root node first.
(2) Traverse the left sub tree in preorder.
(3) Traverse the right sub tree in preorder.

     

InOrder Traversal

Steps for Inorder Traversal:
(1) Traverse the left sub tree in inorder.
(2) Process the root node.
(3) Traverse the right sub tree in inorder.

PostOrder Traversal

Steps for PostOrder Traversal:
(1) Traverse the left sub tree in Post order.
(2) Traverse the right sub tree in Post order.
(3) Process the root node.

Now Consider Following Example

Tree Traversal

PreOrder Traversal : A B D E C F G
InOrder Traversal : D B E A F C G
PostOrder Traversal : D E B F G C A

Download Projects


Download Programs