首页 > 代码库 > 二叉树的存储与遍历

二叉树的存储与遍历

typedef char status;
typedef char Telemtype;
#define NULL 0
#define OK   1
typedef struct bitnode{
	Telemtype data;
	struct bitnode *lchild,*rchild;
}bitnode,*bitree;
Creatbitree(bitree &t)
{
//先序创建二叉树
	char ch;
	scanf("%c",&ch);
	if(ch=='*') t=NULL;
	else{
		t=(bitnode *)malloc(sizeof(bitnode));
		if(!t) exit(0);
		t->data=http://www.mamicode.com/ch;>
编译运行结果如下:
<img src=http://www.mamicode.com/"http://img.blog.csdn.net/20140530230219765" alt="" />>