struct TreeNode* invertTree(struct TreeNode* root)
{ if ( NULL == root )
{
return NULL;
} if ( NULL == root->left && NULL == root->right )
{
//叶子节点
return root;
} //交换左右子节点
struct TreeNode * pTreeNodeTmp = root->left; root->left = root->right;
root->right = pTreeNodeTmp; invertTree(root->left);
invertTree(root->right); return root;
}
相关文章
- 09-27【URAL1018】Binary Apple Tree
- 09-27236.Lowest Common Ancestor of a Binary Tree
- 09-2730 Day Challenge Day 7 | Leetcode 235. Lowest Common Ancestor of a Binary Search Tree
- 09-27236. Lowest Common Ancestor of a Binary Tree 二叉树的最低公共祖先
- 09-277-235. Lowest Common Ancestor of a Binary Search Tree
- 09-27letecode [235] - Lowest Common Ancestor of a Binary Search Tree
- 09-27Python3解leetcode Lowest Common Ancestor of a Binary Search TreeBinary Tree Paths
- 09-27LeetCode-236 Lowest Common Ancestor of a Binary Tree
- 09-27236. Lowest Common Ancestor of a Binary Tree
- 09-27LeetCode236. Lowest Common Ancestor of a Binary Tree(二叉树的最近公共祖先)