The binary tree is very important in the data structure, and the routine construction tree is built with a queue. The statement is more complicated. I have complicated the algorithm for recursive trees when I study the data structure. The statement is relatively simple, the algorithm is as follows:
Typedef struct node // binary knot structure {char ch; struct node * lchild, * rchild; left pointer and right pointer} Bitree
Bitree * createbitree () {char ch; Bitree * b; ch = getchar ();
IF (ch == '@') // indicates that the node is a hollow node {b = null;} else {b = (bitree *) malloc (sizeof (bitree)); b-> data = ch; b- > lchild = cretebitree (); b-> rchild = createbitree ();
Return B;