-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathtree2.cpp
More file actions
73 lines (43 loc) · 960 Bytes
/
tree2.cpp
File metadata and controls
73 lines (43 loc) · 960 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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
#include <bits/stdc++.h>
using namespace std;
struct tnode{
int data;
tnode *left;
tnode *right;
};
class Queue{
private:
int arr[50];
}
int main(){
tnode *root = NULL;
int dtemp, h;
cout << "Enter height of tree" << endl;
cin >> h;
cout << "Enter root node" << endl;
cin >> dtemp;
tnode *temp = new tnode();
temp->left = NULL;
temp->right = NULL;
temp->data = dtemp;
root = temp;
int q;
for(int i = 1; i < h; i++){
cout << "Level no.: " << i << endl;
for(int j = 0; j < pow(2, i-1); j++){
cout << "Is left element tere??" << endl;
cin >> q;
if(q == 0){
}
else{
}
cout << "Is right element tere??" << endl;
cin >> q;
if(q == 0){
}
else{
}
}
}
return 0;
}