¡¡¡¡¶þ²æÊ÷µÄ´´½¨ÓëµÝ¹é±éÀú£¬´úÂëÈçÏ£º
¡¡¡¡#include<stdio.h>
¡¡¡¡#include<stdlib.h>
¡¡¡¡typedef struct Node
¡¡¡¡{
¡¡¡¡char data;
¡¡¡¡struct Node *lch;
¡¡¡¡struct Node *rch;
¡¡¡¡}BiNode, *BiTree;
¡¡¡¡void Creat1£¨BiTree *T£©£»
¡¡¡¡//¶þ²æÊ÷µÄ´´½¨£¬µÚÒ»ÖÖ·½·¨ BiTree Creat2£¨£©
¡¡¡¡//¶þ²æÊ÷µÄ´´½¨£¬µÚ¶þÖÖ·½·¨ void Preorder£¨BiTree T£©£»
¡¡¡¡//ÏÈÐò±éÀú void Inorder£¨BiTree T£©£»
¡¡¡¡//ÖÐÐò±éÀú void Postorder£¨BiTree T£©£»
¡¡¡¡//ºóÐø±éÀú
¡¡¡¡int main£¨void£©
¡¡¡¡{
¡¡¡¡BiTree T;
¡¡¡¡Creat1£¨&T£©£»
¡¡¡¡//¶þ²æÊ÷µÄ´´½¨£¬µÚÒ»ÖÖ·½·¨
¡¡¡¡// T = Creat2£¨£©£»
¡¡¡¡//¶þ²æÊ÷µÄ´´½¨£¬µÚ¶þÖÖ·½·¨
¡¡¡¡Preorder£¨T£©£»
¡¡¡¡//ÏÈÐò±éÀú
¡¡¡¡printf£¨"\n"£©£»
¡¡¡¡Inorder£¨T£©£»
¡¡¡¡//ÖÐÐò±éÀú
¡¡¡¡printf£¨"\n"£©£»
¡¡¡¡Postorder£¨T£©£»
¡¡¡¡//ºóÐø±éÀú
¡¡¡¡return 0;
¡¡¡¡}
¡¡¡¡void Creat1£¨BiTree *T£©
¡¡¡¡//¶þ²æÊ÷µÄ´´½¨£¬µÚÒ»ÖÖ·½·¨
¡¡¡¡{
¡¡¡¡char c;
¡¡¡¡printf£¨"ÇëÊäÈëÊý¾Ý£º"£©£»
¡¡¡¡c = getchar£¨£©£»
¡¡¡¡flushall£¨£©£»
¡¡¡¡if£¨c != '$'£©
¡¡¡¡{
¡¡¡¡£¨*T£© = £¨BiNode *£©malloc£¨sizeof£¨BiNode£©£©£»
¡¡¡¡£¨*T£©->data = c;
¡¡¡¡Creat£¨&£¨£¨*T£©->lch£©£©£»
¡¡¡¡Creat£¨&£¨£¨*T£©->rch£©£©£»
¡¡¡¡}
¡¡¡¡else
¡¡¡¡{
¡¡¡¡£¨*T£© = NULL;
¡¡¡¡}
¡¡¡¡}
¡¡¡¡BiTree Creat2£¨£©