| 1 2 3 4 5 6 7 8 9 |
#include'RBTree.h' #include #include #include using namespace std; int main() { //int a[] = {40,20,60,50,80,70,90 }; int a[] = { 35,20,10,27,400,105,600,70,150,500,700,50,85 }; int check_insert = 0; int check_remove = 0; int i; int ilen = (sizeof(a)) / (sizeof(a[0])); RBTree* tree = new RBTree(); cout << '== 原始数据: '; for (i = 0; i cout << a[i] << ' '; cout << endl; for (i = 0; i { tree->insert(a[i]); // 设置check_insert=1,测试'添加函数' if (check_insert) { cout << '== 添加节点: ' << a[i] << endl; cout << '== 树的详细信息: ' << endl; tree->print(); |