?? main.cpp
字號:
#include "bst.h"
int main()
{
BST<int> bst1;
int a[8] = {23, 45, 12, 9, 123, 87, 22, 9};
for (int i = 0; i < 8; i++) {
bst1.insert(a[i]);
}
cout << bst1.max() << endl;
cout << bst1.min() << endl;
int b = 145;
if (bst1.find(b))
cout << "successful" << endl;
else
cout << "cannot find " << b << endl;
bst1.remove(b);
BSTNode<int> *root = bst1.getRoot();
if (root)
cout << root->getData() << endl;
BSTNode<int> *temp = bst1.leftChild(bst1.getRoot());
if (temp)
cout << temp->getData() << endl;
temp = bst1.parent(bst1.leftChild(bst1.leftChild(bst1.getRoot())));
if (temp)
cout << temp->getData() << endl;
bst1.inOrder();
cout << endl;
cout << bst1.size() << endl;
cout << endl << bst1.depth() << endl << endl;
BST<int> bst2 = bst1;
if (bst2 == bst1)
cout << "equal" << endl;
else
cout << "not equal" << endl;
return 0;
}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -