/* Binary sorting tree */
# Include <stdlib. h>
# Include <stdio. h>
Int counter;/* counter */
Struct tree/* structure of the phonograph */
{Struct tree * left;
Int data;
Struct tree * right;
};
Typedef struct tree treenode;/* declare the structure of the new type tree */
Typedef treenode * B _tree;/* declares the linked list of a binary tree */
B _tree insert_node (B _tree root, int node)/* Insert a binary tree node */
{B _tree newnode;
B _tree currentnode;
B _tree parentnode;
Newnode = (B _tree) malloc (sizeof (treenode);/* allocate new Node space */
Newnode-> data = node;
Newnode-> right = NULL;
Newnode-> left = NULL;
If (root = NULL) return newnode;
Else {currentnode = root;
While (currentnode! = NULL)
{Parentnode = currentnode;
If (currentnode-> data> node)
Currentnode = currentnode-> left;
Else currentnode = currentnode-> right;
}
If (parentnode-> data> node)
Parentnode-> left = newnode;
Else
Parentnode-> right = newnode;
}
Return root;/* return the pointer to the root node */
}
B _tree create_btree (int * data, int len)/* Create a binary tree */
{
B _tree root = NULL;
Int I;
For (I = 0; I <len; I ++)
Root = insert_node (root, data [I]);
Return root;
}
Void inorder (B _tree point)
{