剑指Offer(18)______二叉树的镜像
来源:互联网 发布:linux给其他用户权限 编辑:程序博客网 时间:2024/06/04 19:27
操作给定的二叉树,将其变换为源二叉树的镜像。
输入描述:
二叉树的镜像定义:源二叉树 8 / \ 6 10 / \ / \ 5 7 9 11 镜像二叉树 8 / \ 10 6 / \ / \ 11 9 7 5
class Solution {public: void Mirror(TreeNode *pRoot) { if(pRoot == NULL) return; //鲁棒性:判断树是否为空 TreeNode* temp = pRoot->left; pRoot->left = pRoot->right; pRoot->right = temp; Mirror(pRoot->left); Mirror(pRoot->right); }};
0 0
- 剑指Offer(18)______二叉树的镜像
- 剑指Offer(4)______重建二叉树
- 【剑指offer】二叉树的镜像
- [剑指Offer]二叉树的镜像
- 剑指offer--二叉树的镜像
- 剑指Offer-二叉树的镜像
- 《剑指offer》二叉树的镜像
- 剑指 offer:二叉树的镜像
- 【剑指offer】二叉树的镜像
- 剑指offer 二叉树的镜像
- [剑指offer]二叉树的镜像
- 《剑指offer》-二叉树的镜像
- 剑指Offer:二叉树的镜像
- 剑指offer|二叉树的镜像
- 《剑指offer》二叉树的镜像
- 剑指Offer:二叉树的镜像
- 【剑指offer】二叉树的镜像
- 剑指Offer:二叉树的镜像
- 剑指Offer(17)______树的子结构
- Spark-0.8新增Fair Scheduler资源调度
- 使用AndroidStudio配置OpenCV
- 【学术篇】oj.jzxx.net2701 无根树
- 设计模式系列(4)迪米特法则形象解释
- 剑指Offer(18)______二叉树的镜像
- mysql 触发器,存储过程
- Activity的四种启动模式(standard、singleTop、singleTask、singleInstance)
- CentOS 7搭建JAVA运行环境
- 剑指Offer(19)______顺时针打印矩阵
- Run Spark on Mesos with Zookeeper
- 剑指Offer(20)______包含min的栈
- Tmux快捷健
- 使用腾讯第三方平台进行QQ登陆到本应用