前序遍历线索化二叉树
#include <stdio.h> #include <stdlib.h> #define OK 1 #define ERROR 0 typedef enum PointerTag {Link,Thread}; typedef int Status; typedef struct BiTNode { char data; struct BiTNode *lchild,*rchild; enum PointerTag LTag,RTag; }BiTNode,*BiTree; int CreateBiTree(BiTree *T); Status Visit(char e); Status PreOrderThreadTraverse(BiTree T); Status PreOrderThreadBackTraverse(BiTree T); Status PreOrderThreading(BiTree Thrt,BiTree T); void PreThreading(BiTree p,BiTree *pre); Status PreOrderTraverse(BiTree T); int main() { BiTree *T,Thrt; T=(BiTree*)malloc(sizeof(BiTree)); Thrt=(BiTree)malloc(sizeof(BiTNode)