二叉树遍历的简单应用
代码语言:javascript
复制struct node {
int val;
node *left, *right;
};
node *swapSubTree(node *root) {
if (!root) return NULL;
else {
//交换的过程
node *tmp = root->left;
root->left = root->right;
root->right = tmp;
swapSubTree(root->left);
swapSubTree(root->right);
}
return root;
}