你的浏览器不支持本网站所要求的功能, 现在看到的是本网站简化版本.

为了获得最佳体验, 请使用最新的Chrome, Safari, Firefox 或 Edge 浏览器.

10. 树

10.5 二叉树与树的转换

Powered by impress.js
Ver. 2408

### 二叉树与树和森林的转换 - 一棵树可以转换成唯一一棵二叉树 - 一棵二叉树可以转换成唯一一棵树 - 一个森林可以转换成唯一一棵二叉树 - 一棵二叉树可以转换成唯一一个森林
### 树到二叉树的转换 - 把兄弟变孩子方法 - 在兄弟结点之间加连线 - 除最左边外, 删除原有父子连线 - 拎起来抖一抖
![Convert Generic Tree to Binary Tree 1](img/c10/t2b1.gif) #### Convert Generic Tree to Binary Tree 1
![Convert Generic Tree to Binary Tree 2](img/c10/t2b2.gif) #### Convert Generic Tree to Binary Tree 2
![Convert Generic Tree to Binary Tree 3](img/c10/t2b3.gif) #### Convert Generic Tree to Binary Tree 3
### 二叉树到树的转换 - 把孩子变兄弟方法 - 把右孩子提成兄弟 - 添加新父子关系 - 删除原有兄弟关系
![Convert Binary Tree to Generic Tree 1](img/c10/b2t1.gif) #### Convert Binary Tree to Generic Tree 1
![Convert Binary Tree to Generic Tree 2](img/c10/b2t2.gif) #### Convert Binary Tree to Generic Tree 2
![Convert Binary Tree to Generic Tree 3](img/c10/b2t3.gif) #### Convert Binary Tree to Generic Tree 3
### 森林到二叉树的转换 - 将每棵树都转成二叉树 - 将其它树的根变成第一棵树的右孩子
### 二叉树到森林的转换 - 根有右孩子时才能转换成森林 - 断开每一级的右孩子 - 分别转成树
![course 10.5 mindmap](img/c10/mindmap-10-5.png)
### 10.5 二叉树与树的转换 - 一棵普通树如何转换成唯一的二叉树? - 一棵二叉树如何转换成唯一的普通树? - 一棵二叉树如何转换成一个唯一的森林? - 将森林转换为二叉树时, 如何处理每棵树的根结点? - 为什么根有右孩子时才能转换成森林? ---- [ 10.4 二叉树的遍历](dbds-10-4.html#/overview) [| 练习 |](dbds-exec.html) [ 11.1 图的基本概念](dbds-11-1.html#/overview)

黑公网安备23010302001726号   黑ICP备2024033110号-1