破防了 看不懂
做了一天的二叉树,头是个晕的,中序线索化的代码看不懂,明天再搞吧哎
#include<stdio.h>
#include<stdlib.h>
typedef struct Node
{
int data;
struct Node* pleft;
struct Node* pright;
int tagleft;
int tagright;
}node, * pnode;
node *pre = NULL;
void inorder(pnode p)//中序线索化
{
if (p)
{
inorder(p->pleft);
if (p->pleft == NULL)
{
p->tagleft = 1;
p->pleft = pre;
}
if (pre->pright = NULL)
{
pre->tagright = 1;
pre->pright = p;
}
pre = p;
inorder(p->pright);
}
}