-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathRBMain.cpp
More file actions
50 lines (46 loc) · 922 Bytes
/
RBMain.cpp
File metadata and controls
50 lines (46 loc) · 922 Bytes
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
#include <iostream>
#include<algorithm>
#include <string>
#include <sstream>
#include<vector>
#include<math.h>
#include <iomanip>
#include <map>
#include<set>
#include <fstream>
#include <numeric>
#include <queue>
#include"Tree.h"
using namespace std;
//25 50 75 60 68 10 18 15 6 3 7
//udalit 18 potom 3
int main()
{
setlocale(LC_ALL, "Russian");
RBT* tree = new RBT();
cout << "Ñêîëüêî ýëåìåíòîâ â äåðåâå?";
int tmp;
cin >> tmp;
int x;
for (int i = 0; i < tmp; i++)
{
cin >> x;
tree->insertNode(x);
}
cout << "\nPreorder\n";
tree->preorder(tree->root);
cout << "\nInorder\n";
tree->inorder(tree->root);
cout << "\nPostorder\n";
tree->postorder(tree->root);
cout << "\nÑêîëüêî ýëåìåíòîâ udalit?";
cin >> tmp;
for (int i = 0; i < tmp; i++)
{
cin >> x;
tree->delNode(x);
cout << "\nPreorder\n";
tree->preorder(tree->root);
}
return 0;
}