|
Trees->Binary Tree Creation |
||
| The binary tree
creation follows a very simple principle -- for the new element to be
added, compare it with the current element in the tree. If its value is
less than the current element in the tree then move towards the left
side of that element or else to its right. If there is no sub tree on
the left, make your new element as the left child of that current
element or else compare it with the existing left child and follow the
same rule. Exactly same has to done for the case when your new element
is greater than the current element in the tree but this time with the
right child. Check out the algo..
Algorithm:- C implementation:- create_tree( struct NODE
*curr, struct NODE *new ) Related Operations: |
||
| Index || Doubts / Clarifications || Related Topics || Web Links | ||