📄 linkedbintree.cpp
字号:
// LinkedBinTree.cpp : Defines the entry point for the console application.
//
#include "stdafx.h"
#include "CBinTree.h"
#include "string.h"
int main(int argc, char* argv[])
{
BinTree<int> BT1(-1);
int i=0,j=0;
cout<<"InOrder print:"<<endl;
BT1.InOrder(BT1.GetTop());
cout<<endl;
cout<<"Level print:"<<endl;
BT1.LevelOrder(BT1.GetTop());
cout<<endl;
BT1.LeafSize(BT1.GetTop(),i);
cout<<"The leaf_node size:"<<i<<endl;
BT1.OffsetSize(BT1.GetTop(),j);
cout<<"The offset_node size:"<<j+1<<endl;
int h=BT1.Height(BT1.GetTop());
cout<<"The height of the tree is:"<<h<<endl;
cout<<"Input the node which you want to search:";
int k;
cin>>k;
if(BT1.Search(k,BT1.GetTop())==NULL) cout<<"The node searched doesn't exit!"<<endl;
else
cout<<"The searched node's address is:"<<BT1.Search(k,BT1.GetTop())<<endl;
cout<<"Input the node which you want to remove:";
cin>>k;
BinTreeNode<int> *p=BT1.GetTop();
bool w=BT1.Remove(k,p);
if(w==false) cout<<"The node should be removed doesn't exit!"<<endl;
else
{
cout<<"Print the removed tree in level:"<<endl;
BT1.LevelOrder(p);
cout<<endl;
}
return 0;
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -