-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdemo_client_3.cpp
More file actions
105 lines (73 loc) · 3.35 KB
/
demo_client_3.cpp
File metadata and controls
105 lines (73 loc) · 3.35 KB
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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
#include "demo_final_2.cpp"
// #include "test2_m.cpp"
#include <iostream>
#include <string>
using namespace std;
int main()
{
// Union
// Intersection
// Difference
cout<<"\n--------------------------------------------------------------------------------------------------------------------------------\n\n";
Treap_t<int> t_1;
t_1.insert(19);
t_1.insert(23);
t_1.insert(5);
t_1.insert(1);
t_1.insert(90);
t_1.insert(28);
t_1.insert(55);
t_1.insert(82);
t_1.insert(100);
t_1.insert(9);
// for(int i = 0; i<30; i++)
// {
// t_1.insert(rand()%100);
// }
cout<<"Tree T_1:\n\n"<<t_1<<"\n";
cout<<"\n--------------------------------------------------------------------------------------------------------------------------------\n\n";
// Treap_t<double> t_2;
// t_2.insert(1.5);
// t_2.insert(83.972);
// t_2.insert(5.0);
// t_2.insert(12.28);
// t_2.insert(59.08);
// t_2.insert(3.14);
// t_2.insert(99.99);
// cout<<"Tree T_2:\n\n"<<t_2<<"\n";
// cout<<"\n--------------------------------------------------------------------------------------------------------------------------------\n\n";
// Treap_t<string> t_3;
// t_3.insert("D");
// t_3.insert("B");
// t_3.insert("G");
// t_3.insert("A");
// t_3.insert("P");
// t_3.insert("Q");
// t_3.insert("T");
// cout<<"Tree T_3:\n\n"<<t_3<<"\n";
// cout<<"\n--------------------------------------------------------------------------------------------------------------------------------\n\n";
vector<int> v_1 = {9, 82, 158, 1912, 174, 242, 99, 108, 235, 911, 100, 102, 555};
Treap_t<int> t_4(v_1.begin(), v_1.end());
cout<<"Tree T_4:\n\n"<<t_4<<"\n";
cout<<"\n--------------------------------------------------------------------------------------------------------------------------------\n\n";
Treap_t<int> t_5;
t_5.union_treaps(&t_1, &t_4);
cout<<"Tree T_5 (Union of T_1 and T_4):\n\n"<<t_5<<"\n";
cout<<"\n--------------------------------------------------------------------------------------------------------------------------------\n\n";
Treap_t<int> t_6;
t_6.intersect_treaps(&t_1, &t_4);
cout<<"Tree T_6 (Intersect of T_1 and T_4):\n\n"<<t_6<<"\n";
cout<<"\n--------------------------------------------------------------------------------------------------------------------------------\n\n";
Treap_t<int> t_7;
t_7.diff_treap(&t_1, &t_4);
cout<<"Tree T_7 (Difference of T_1 and T_4):\n\n"<<t_7<<"\n";
cout<<"\n--------------------------------------------------------------------------------------------------------------------------------\n\n";
Treap_t<int> t_8;
t_8.diff_treap(&t_4, &t_1);
cout<<"Tree T_8 (Difference of T_4 and T_1):\n\n"<<t_8<<"\n";
cout<<"\n--------------------------------------------------------------------------------------------------------------------------------\n\n";
// cout<<"Tree T_1:\n\n"<<t_1<<"\n";
// cout<<"\n--------------------------------------------------------------------------------------------------------------------------------\n\n";
// cout<<"Tree T_4:\n\n"<<t_4<<"\n";
// cout<<"\n--------------------------------------------------------------------------------------------------------------------------------\n\n";
}