📄 bst.cpp
字号:
// test binary search tree class
#include <iostream.h>
#include "bst.h"
BSTree<DataType,int> y;
void main(void)
{
DataType q;
for (int i=0;i<5;i++)
{ cin>>q;
y.Insert(q);
}
cout << "Elements in ascending order are" << endl;
y.Ascend();
DataType s;
try{
y.DeleteMax(s);
cout<<s<<endl;
y.Delete(4,s);
cout << "Delete of 4 succeeds " << endl;
cout <<s<< endl;
cout << "Elements in ascending order are" << endl;
y.Ascend();
y.Delete(8,s);
cout << "Delete of 8 succeeds " << endl;
cout << s << endl;
cout << "Elements in ascending order are" << endl;
y.Ascend();
y.Delete(6,s);
cout << "Delete of 6 succeeds " << endl;
cout << s<< endl;
cout << "Elements in ascending order are" << endl;
y.Ascend();
y.Delete(6,s);}
catch (...)
{cout << "Delete fails " << endl;}
cout << "Elements in ascending order are" << endl;
y.Ascend();
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -