by Dinesh Thakur Category: Trees

An important class of digraph, which involves for the description of hierarchy. A directed tree is an acyclic digraph which has one node called root with in degree 0, while other nodes have in degree Every directed tree must have at least one node.

An isolated node is also called as directed tree. The node with out degree as 0 is called as leaf. The length of the path from root to particular node level of the node. If the ordering of the node at each level is prescribed then the tree is called as ordered tree.            

Binary Tree

            If a tree has at most of two children, then such tree is called as Binary tree. If the elements in the binary tree are arranged in the following order

            Left element is lesser than the root

            Right element is greater then the root

            No duplication of elements

Then such binary tree is called as Binary Search Tree

           

Operations performed in a binary tree are:

 

    • Inserting a node
    • Deleting a node
    • Traversing the tree
    •  

Traversing Methods

 

1.      Pre – order method

2.      In – order method

3.      Post – order method

4.      Converse Pre – order method

5.      Converse In – order method

6.      Converse post – order method

Pre – order method

            This method gives the tree key value in the following manner: -

1.      Process the root

2.      Traverse the left sub tree

3.      Traverse the right Sub tree

In – order method

            This method gives the tree key value in the following manner: -

1.      Traverse the left sub tree

2.      Process the root

3.      Traverse the right Sub tree

Post – order method

            This method gives the tree key value in the following manner: -

1.      Traverse the left sub tree

2.      Traverse the right Sub tree

3.    Process the root

 



About Dinesh Thakur

Dinesh ThakurDinesh Thakur holds an B.SC (Computer Science), MCSE, MCDBA, CCNA, CCNP, A+, SCJP certifications. Dinesh authors the hugely popular blog. Where he writes how-to guides around Computer fundamental , computer software, Computer programming, and web apps. For any type of query or something that you think is missing, please feel free to Contact us.



Search Content