📄 7-4.c
字号:
#include "stdio.h"
typedef char Datatype;
typedef struct threaded_tree *pt_threaded;
typedef struct threaded_tree {
short int left_thread;
pt_threaded left_child;
Datatype data;
pt_threaded right_child;
short int right_thread;
};
pt_threaded succ( pt_threaded tree)
{ //在树中找到结点的中序前驱
pt_threaded temp;
temp = tree->right_child;
if ( !tree->right_thread )
while( !temp->left_child )
temp = temp->left_child;
return temp;
}
void inorder(pt_threaded tree)
{ //中序遍历线索二叉树
pt_threaded temp=tree;
for(; ;){
temp = succ (temp);
if (temp = tree) break;
printf ("%3c", temp->data);
}
}
void main()
{
pt_threaded p;
inorder(p);
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -