-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.cpp
More file actions
40 lines (34 loc) · 735 Bytes
/
main.cpp
File metadata and controls
40 lines (34 loc) · 735 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
#include <iostream>
using namespace std;
struct OrderTree{
OrderTree *left;
OrderTree *front;
OrderTree *right;
char name;
};
//liscie
OrderTree E = {NULL, NULL, NULL, 'E'};
OrderTree F = {NULL, NULL, NULL, 'F'};
OrderTree G = {NULL, NULL, NULL, 'G'};
OrderTree H = {NULL, NULL, NULL, 'H'};
OrderTree I = {NULL, NULL, NULL, 'I'};
OrderTree J = {NULL, NULL, NULL, 'J'};
//ojcowie
OrderTree B = {&E, NULL, &F, 'B'};
OrderTree C = {&G, &H, &I, 'C'};
OrderTree D = {NULL, NULL, &J, 'D'};
//korzen
void inorder(OrderTree *a){
if(a){
inorder(a->left);
inorder(a->front);
cout<<a->name<<" ";
inorder(a->right);
}
}
OrderTree A = {&B, &C, &D, 'A'};
int main(){
ios_base::sync_with_stdio(0);
inorder(&A);
cout<<'\n';
}