#include <stdio.h>
#include <stdlib.h>
#include <malloc.h>
typedef int ElemType;
typedef struct BiTNode
{
ElemType data;
struct BiTNode*lChild, *rChlid;
}BiTNode, *BiTree;
int CreateBiTree(BiTree *T)
{
ElemType ch;
ElemType temp;
scanf("%d", &ch);
temp = getchar();
if (ch == -1)
*T = NULL;
else
{
*T = (BiTree)malloc(sizeof(BiTNode));
if (!(*T))
exit(-1);
(*T)->data = ch;
printf("输入%d的左子节点:", ch);
CreateBiTree(&(*T)->lChild);
printf("输入%d的右子节点:", ch);
CreateBiTree(&(*T)->rChlid);
}
return 1;
}
本内容试读结束,登录后可阅读更多
下载后可阅读完整内容,剩余3页未读,立即下载