226 Invert Binary Tree
2015-11-14 20:18
246 查看
/** * Definition for a binary tree node. * struct TreeNode { * int val; * TreeNode *left; * TreeNode *right; * TreeNode(int x) : val(x), left(NULL), right(NULL) {} * }; */ class Solution { public: TreeNode* invertTree(TreeNode* root) { if(root==NULL) return NULL; TreeNode *tmp = root->left; root->left = root->right; root->right = tmp; invertTree(root->left); invertTree(root->right); return root; } };
相关文章推荐
- 1010. Radix (25)
- Hadoop分布式缓存(DistributedCache)
- 59. 预定义超全局变量
- 压缩感知中的lp球:p范数最优化为什么总会导致一个稀疏的解的原因
- 【转】熵、信息增益以及其他
- 《大道至简》第七章第八章读后感
- jemalloc/jemalloc.h: No such file or directory
- CentOS下MySQL 5.7.9编译安装步骤详解
- 开篇
- 283 Move Zeroes
- 【转】C++ 智能指针详解
- iOS9的网络请求简述
- 无法解析的外部符号解决方法汇总
- python import UMD has deleted
- CALayer
- 100 Same Tree
- Android Shellcode Telnetd with Parameters
- eclipse工具栏不显示sdk和adb图标?
- 【Java基础】List迭代并修改时出现的ConcurrentModificationException问题
- 237 Delete Node in a Linked List