拓展四(1)
线索二叉树
#include <stdio.h>
#include <stdlib.h>
typedef char ElemType;
//线索存储标志位
//Link(0):表示指向左右孩子的指针
//Thread(1):表示指向前驱后继的线索
typedef enum {
Link,Thread} PointerTag;
typedef struct BiThrNode
{
char data;
struct BiThrNode *lchild, *rchild;
PointerTag ltag, rtag;
}BiThrNode, *BiThrTree;
//全局变量 始终指向上一访问的结点
BiThrTree pre;
//创建一棵二叉树,约定用户遵照前序遍历的方式输入数据
void CreateBiThrTree(BiThrTree *T)
{
char c;
scanf("%c", &c);
if(' ' == c)
{
*T = NULL;
}
else
{
*T = (BiThrNode *)malloc(sizeof