all tree data structure code example
Example 1: tree data structure
If root is NULL
then create root node
return
If root exists then
compare the data with node.data
while until insertion position is located
If data is greater than node.data
goto right subtree
else
goto left subtree
endwhile
insert data
end If
Example 2: tree data structure
struct node {
int data;
struct node *leftChild;
struct node *rightChild;
};