?? bstree1m.cpp
字號:
//二叉搜索樹的類型測試BSTree1M.cpp
#include<iostream.h>
#include<iomanip.h>
#include<stdlib.h>
#include<conio.h>
#include "BSTree1.h"
TNode<char> *q;
void main()
{cout<<"BSTree1M.cpp運行結果:\n";
int i;
char test[50]="abxycdMNefgzkl";
BSTree<char> t(q);
//cout<<"input data:\n";
//gets(test);
for(i=0;test[i]!='\0';i++)
t.BSTInsert(q,test[i]);
cout<<"中序遍歷二叉搜索樹:\n";
t.Inorder(q);
cout<<"\n二叉搜索樹的結點數="<<t.BSTSize()<<endl;
cout<<"二叉搜索樹的結點數="<<t.BSTreeCount(q)<<endl;
cout<<"二叉搜索樹的深度="<<t.BSTreeDepth(q)<<endl;
cout<<"二叉搜索樹的葉子結點數="<<t.BSTreeLeafCount(q)<<endl;
cout<<"Press any key and delete 'd'\n";
getch();
t.BSTDelete(q,'d');
cout<<"中序遍歷二叉搜索樹:\n";
t.Inorder(q);
cout<<"\n二叉搜索樹的結點數="<<t.BSTSize()<<endl;
cout<<"二叉搜索樹的結點數="<<t.BSTreeCount(q)<<endl;
cout<<"二叉搜索樹的深度="<<t.BSTreeDepth(q)<<endl;
cout<<"二叉搜索樹的葉子結點數="<<t.BSTreeLeafCount(q)<<endl;
getch();
t.FreeBST(q);
}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -