⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 main.cpp

📁 中序线索化的二叉树 能够对二叉树先线索化然后再中序排列 并且输出
💻 CPP
字号:
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
#include "treeabc.h"
#include "avl.h"
#include "print.h"
#include "thread.h"
using namespace std;

int main()
{
     int i;
     AVLTree* pRoot = NULL;

     srand((unsigned int)::time(NULL));
    
     for (i = 0; i < 10; ++i)
     {
         pRoot = Insert(::rand(), pRoot);
     }

     PrintTree(pRoot);


     BiTree = (AVLTree *)malloc(sizeof(AVLTree));
      //cout<<"输入节点数据(char 型)(#代表NULL):"<<endl;
      //BiTree = CreateBiTree(BiTree);
     BiTree = InOrderThreading(pRoot);
     cout<<"线索化后遍历输出:"<<endl;
     InOrderTraverse(pRoot);
     cout<<"pRoot指针的value是:"<<pRoot->nData<<"  nHeight值为:"<<pRoot->nHeight<<endl;
     cout<<"pRoot指针的左子的value是"<<pRoot->pLeft->nData<<"  nHeight值为:"<<pRoot->pLeft->nHeight<<endl;
     //printBTree(pRoot);
     //DeleteTree(&pRoot);

     
     system("pause");
     return 0;
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -