#include <stdio.h>
#include <vector>
#include <iostream>
#include <algorithm>
using namespace std;
/**
* Definition for binary tree
**/
struct TreeNode {
int val;
TreeNode *left;
TreeNode *right;
TreeNode(int x) : val(x), left(NULL), right(NULL) {}
};
//先序遍历
void PreOrder(TreeNode *root)
{
if (root == NULL)
return;
std::cout << root->val << ' ';
PreOrder(root->left);
PreOrder(root->right);
}
//中序遍历
void InOrder(TreeNode *root)
{
if (root == NULL)
return;
InOrder(root->left);
std::cout << root->val << " ";
InOrder(root->right);
}
//后序遍历
void PostOrder(TreeNode *root)
{
if (root == NULL) r