General Tree


A Tree in which each node having either 0 or more child nodes is called general tree. So we can say that a Binary Tree is a specialized case of General tree.
General Tree is used to implement File System.
Consider Following Figure:

General Tree
     

Conversion of General Tree in to Binary Tree


The process of converting general tree in to binary tree is given below:
(1) Root node of general tree becomes root node of Binary Tree.
(2) Now consider T1, T2, T3 ... Tn are child nodes of the root node in general tree. The left most child (T1) of the root node in general tree becomes left most child of root node in the binary tree. Now Node T2 becomes right child of Node T1, Node T3 becomes right child of Node T2 and so on in binary tree.
(3) The same procedure of step 2 is repeated for each leftmost node in the general tree.
Consider following general tree:

General Tree

Now step by step we convert general tree into binary tree.
Step 1: Root Node of General tree becomes the Root node of binary tree.

General Tree

Step 2: Now Root Node (A) has three child Nodes (B, H, E) in general tree. The leftmost node (B) of the root node (A) in the general tree becomes the left most node of the root node (A) in binary tree.

General Tree

Step 3: Now Node H becomes the right node of B and Node E becomes the right node of H.

General Tree

Step 4: Now Node B has only one left child node, which is C in general tree. So Node C becomes left child of Node B in binary tree.

General Tree

Step 5: Now Node E has two child nodes (F, G). The leftmost node (F) of the node (E) in the general tree becomes the left most node of the node E in the binary tree.

General Tree

Step 6: Now Node G becomes right node of Node F in binary tree.

General Tree

Download Projects


Download Programs