求程序:线索二叉的应用

来源:百度知道 编辑:UC知道 时间:2024/06/30 21:45:21
数据结构课程设计题目 线索二叉的应用。要求:线索二叉树的建立、插入、删除、恢复线索的实现。 求源程序及算法思想,源程序要有相应的注释,程序截图等。 一经采用将追加50分。
程序要能实现题目的所有要求, 算法思想、截图等全部发我邮箱:jqrr2005ship@126.com 采用后必定多多加分 谢谢

呵呵,我刚好学完数据结构,试验的时候自己写了线索二叉树的头文件;

--------------------------------------------------------------
"ThrBinaryTree.h"

#include<iostream>

using namespace std;

typedef char elemType;
struct Thrbnode//线索二叉数的结点;
{
Thrbnode *lchild,*rchild;
int ltag,rtag;//线索的标志;
elemType data;
};

class ThrBinaryTree
{
public:
ThrBinaryTree();
void create(Thrbnode* &tempR);// 创建二叉树(注意是先序创建,没有孩子的节点用.代替。另外是创建二叉树不是线索二叉树)
void visite(Thrbnode *T);//对节点的访问操作;
void preorderThread(Thrbnode *&T,Thrbnode *&pre);//将一个二叉树先序线索化(你主要就是要这个函数的吧);
void inorderThread(Thrbnode *&T,Thrbnode *&pre);//同上,中序线索化;
void postorderThread(Thrbnode *&T,Thrbnode *&pre);//同上,后序线索化;
void ThreadPreorder(Thrbnode *T);//对线索二叉树的先序遍历;(非递归,用到了求结点后继的函数Thrbnode *insuc(Thrbnode *T);)
void ThreadInorder(Thrbnode *T);//同上,中序遍历;
Thrbnode *presuc(Thrbnode *T);//求一个节点T的前驱;
Thrbn