#include<stdio.h>
#include<malloc.h>
// 线索二叉树的存储结构
typedef struct thread_node
{
char data;
struct thread_node* lchild;//线索
struct thread_node* rchild;
int ltag;
int rtag;
}thread_node, *thread_tree;
int cur;//现在指向的结点
char str[1000];//数组存放遍历字符串
//创建二叉树
thread_node* create_tree()//创建树
{
cur++;//指向下一个
if(str[cur] == '#')//如果碰到#,则表示该子树是空结点
{
return NULL;
}
thread_node* root = (thread_node*)malloc(sizeof(thread_node)
不带头结点的线索二叉树(C语言版) 线索化、遍历操作 超详细!
最新推荐文章于 2023-03-29 00:32:06 发布