Invert Binary Tree
2016-07-10 12:32
225 查看
Invertabinarytree.
Example
Example
11 /\/\ 23=>32 /\ 44
/** *DefinitionofTreeNode: *publicclassTreeNode{ *publicintval; *publicTreeNodeleft,right; *publicTreeNode(intval){ *this.val=val; *this.left=this.right=null; *} *} */ publicclassSolution{ /** *@paramroot:aTreeNode,therootofthebinarytree *@return:nothing */ publicvoidinvertBinaryTree(TreeNoderoot){ //writeyourcodehere if(root==null)return; TreeNodeleft=root.left; root.left=root.right; root.right=left; invertBinaryTree(root.left); invertBinaryTree(root.right); } }
相关文章推荐
- 自定义控件
- shell编程之数组
- 排序工具类
- Popupwindow 的使用
- 使用VHDL语言编写基于TEC-8的硬布线控制器
- ADT发生异常错误笔记
- Could not determine type for: model.Student, at table: Contact, for columns: [org.hibernate.mapping.
- MongoDB的C语言编程实例
- Sqrt(x)
- 大江大海 —— 淮河、澜沧江(湄公河)
- 【ReactNative】react-native 布局
- shell编程之函数
- Python 学习工具书
- 【sicily】 1934. 移动小球
- 【大型网站技术实践】初级篇:搭建MySQL主从复制经典架构
- ThreadGroup源码探索
- 关于Kylin结果缓存的思考
- Android AES DES RSA 加密解密 解析
- 世界正游弋于开源之海,但只有 Red Hat 从中盈利
- DataList分页