Monday, October 27, 2014

Steps to construct a binary tree [data structure]

Traversing of Binary tree can be done by as
    (1) Preorder Traversing
    (2) Inorder Traversing
    (3) Postorder Traversing

   
     Preorder traversal Steps
            (1)  Visit the root
                (2)  Traverse the left sub-tree in preorder
                (3)  Traverse the right sub-tree in preorder 




     Inorder traversal Steps
           (1) Traverse the left sub-tree in inorder
               (2) Visit the root
               (3)  Traverse the right sub-tree in inorder



 

     Postorder traversal Steps
           (1) Traverse the left sub-tree in postorder
               (2) Traverse the right sub-tree in postorder
               (3) Visit the root


 

0 comments:

Post a Comment