Physical Address
304 North Cardinal St.
Dorchester Center, MA 02124
Physical Address
304 North Cardinal St.
Dorchester Center, MA 02124
[ad_1]
#embrace <bits/stdc++.h>
utilizing
namespace
std;
struct
Node {
int
information;
struct
Node* left;
struct
Node* proper;
Node(
int
val)
{
information = val;
left = NULL;
proper = NULL;
}
};
void
PostPreInOrderInOneFlowRecursive(Node* root,
vector<
int
>& pre,
vector<
int
>& put up,
vector<
int
>& in)
{
if
(root == NULL)
return
;
pre.push_back(root->information);
PostPreInOrderInOneFlowRecursive(
root->left, pre, put up, in);
in.push_back(root->information);
PostPreInOrderInOneFlowRecursive(
root->proper, pre, put up, in);
put up.push_back(root->information);
}
int
important()
{
struct
Node* root =
new
Node(1);
root->left =
new
Node(2);
root->proper =
new
Node(3);
root->left->left =
new
Node(4);
root->left->proper =
new
Node(5);
root->right->left =
new
Node(6);
root->right->proper =
new
Node(7);
root->left->left->left =
new
Node(8);
root->left->left->left->proper
=
new
Node(12);
root->left->right->left =
new
Node(9);
root->right->right->left =
new
Node(10);
root->right->right->proper =
new
Node(11);
vector<
int
> pre, put up, in;
PostPreInOrderInOneFlowRecursive(
root, pre, put up, in);
cout <<
"Pre Order : "
;
for
(
auto
i : pre) {
cout << i <<
" "
;
}
cout << endl;
cout <<
"Submit Order : "
;
for
(
auto
i : put up) {
cout << i <<
" "
;
}
cout << endl;
cout <<
"In Order : "
;
for
(
auto
i : in) {
cout << i <<
" "
;
}
return
0;
}
[ad_2]