mirror of
https://github.com/krahets/hello-algo.git
synced 2026-04-13 18:00:18 +08:00
Add figure and table numbers in normal texts.
This commit is contained in:
@@ -20,8 +20,8 @@
|
||||
|
||||
根据定义,`preorder` 和 `inorder` 都可以被划分为三个部分:
|
||||
|
||||
- 前序遍历:`[ 根节点 | 左子树 | 右子树 ]` ,例如上图 `[ 3 | 9 | 2 1 7 ]` 。
|
||||
- 中序遍历:`[ 左子树 | 根节点 | 右子树 ]` ,例如上图 `[ 9 | 3 | 1 2 7 ]` 。
|
||||
- 前序遍历:`[ 根节点 | 左子树 | 右子树 ]` ,例如上图的树对应 `[ 3 | 9 | 2 1 7 ]` 。
|
||||
- 中序遍历:`[ 左子树 | 根节点 | 右子树 ]` ,例如上图的树对应 `[ 9 | 3 | 1 2 7 ]` 。
|
||||
|
||||
以上图数据为例,我们可以通过下图所示的步骤得到划分结果:
|
||||
|
||||
@@ -41,7 +41,7 @@
|
||||
|
||||
如下表所示,通过以上变量即可表示根节点在 `preorder` 中的索引,以及子树在 `inorder` 中的索引区间。
|
||||
|
||||
<p align="center"> 表:根节点和子树在前序和中序遍历中的索引 </p>
|
||||
<p align="center"> 表 <id> 根节点和子树在前序和中序遍历中的索引 </p>
|
||||
|
||||
| | 根节点在 `preorder` 中的索引 | 子树在 `inorder` 中的索引区间 |
|
||||
| ------ | -------------------------------- | ----------------------------- |
|
||||
|
||||
@@ -54,7 +54,6 @@
|
||||
2. 将 `A` 中剩余的一个圆盘从 `A` 直接移动至 `C` 。
|
||||
3. 令 `C` 为目标柱、`A` 为缓冲柱,将两个圆盘从 `B` 移动至 `C` 。
|
||||
|
||||
|
||||
=== "<1>"
|
||||

|
||||
|
||||
|
||||
Reference in New Issue
Block a user