- Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path6InOrderTraversal.cpp
More file actions
Latest commit
42 lines (36 loc) · 802 Bytes
/
Copy path6InOrderTraversal.cpp
File metadata and controls
42 lines (36 loc) · 802 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
#include<bits/stdc++.h>
usingnamespacestd;
structNode
{
int data;
Node* left;
Node* right;
Node(int val)
{
data = val;
left = right = NULL;
}
};
voidprintInOrderTraversal(Node* root)
{
if(root == NULL)
{
return;
}
printInOrderTraversal(root->left);
cout<<root->data<<"";
printInOrderTraversal(root->right);
}
intmain()
{
structNode* root = newNode(2);
root->left = newNode(5);
root->right = newNode(7);
root->right->left = newNode(9);
root->right->left->right = newNode(3);
root->right->left->left = newNode(2);
root->right->right = newNode(1);
root->right->left->right->left = newNode(1);
root->right->left->right->right = newNode(4);
printInOrderTraversal(root);
}