?? main.cpp
字號:
#include "head.h"
#include <iostream>
#include <ctime>
const int num = 1000;
int main() {
using namespace std;
srand((unsigned int) time(NULL));
B_plus_Tree<int ,50> tree;
int a[num];
for (int i = 0; i < num / 2; i++) {
a[i] = rand();
tree.Insert(a[i]);
}
tree.Traverse(tree.Getroot());
cout << "The height of the tree is " << tree.Height() << "." << endl;
cout << "The tree contains " << tree.Num_of_Leaf() << " leaf nodes." << endl;
for (int i = num / 2; i < num; i++) {
a[i] = rand();
tree.Insert(a[i]);
}
tree.Traverse(tree.Getroot());
tree.Traverse();
cout << "The height of the tree is " << tree.Height() << "." << endl;
cout << "The tree contains " << tree.Num_of_Leaf() << " leaf nodes." << endl;
for (int i = 0; i < num; i++)
tree.Delete(a[i]);
tree.Traverse(tree.Getroot());
tree.Traverse();
cout << "The height of the tree is " << tree.Height() << "." << endl;
cout << "The tree contains " << tree.Num_of_Leaf() << " leaf nodes." << endl;
return 0;
}
?? 快捷鍵說明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -