-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathmain.cpp
57 lines (41 loc) · 1.13 KB
/
main.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
#include <iostream>
#include "Btree.h"
#include <vector>
#include <stack>
using namespace std;
int main(int argc, char const *argv[]) {
BTree T(3);
BTree T2(4);
int list[] = {30,20,62,110,140,15,65,136,150,120,
40,132,19,128,138,100,16,145,70,42,
69,43,26,60,130,50,18,7,36,58,
22,41,59,57,54,33,75,124,122,123};
int delist[] = { 40, 132, 19, 128, 138, 100, 16, 145, 70, 42,
22, 41, 62, 110, 140, 15, 65, 124, 122, 123,
30, 20, 59, 57, 54, 33, 75, 136, 150, 120,
69, 43, 26, 60, 130, 50, 18, 7, 36, 58
};
for (size_t i = 0; i < 40; i++) {
T.insertBT(list[i]);
T.inorderBT();
}
cout << "===================== delete =================" << endl;
for (size_t i = 0; i < 40; i++)
{
T.deleteBT(delist[i]);
T.inorderBT();
}
cout << "============================== 4 - way =============================" << endl;
for (size_t i = 0; i < 40; i++)
{
T2.insertBT(list[i]);
T2.inorderBT();
}
cout << "===================== delete =================" << endl;
for (size_t i = 0; i < 40; i++)
{
T2.deleteBT(delist[i]);
T2.inorderBT();
}
return 0;
}