auto commit
This commit is contained in:
parent
68da17c813
commit
456be4fa67
BIN
docs/notes/pics/_u91CD_u5EFA_u4E8C_u53C9_u6811-1.gif
Normal file
BIN
docs/notes/pics/_u91CD_u5EFA_u4E8C_u53C9_u6811-1.gif
Normal file
Binary file not shown.
After Width: | Height: | Size: 6.0 KiB |
Binary file not shown.
After Width: | Height: | Size: 23 KiB |
|
@ -316,12 +316,14 @@ preorder = [3,9,20,15,7]
|
|||
inorder = [9,3,15,20,7]
|
||||
```
|
||||
|
||||
<div align="center"> <img src="pics/8a4c6ad4-a816-47d1-b93f-7ca4f78ab67a.png" width="250"/> </div><br>
|
||||
<div align="center"> <img src="pics/_u91CD_u5EFA_u4E8C_u53C9_u6811-1.gif" width="200"/> </div><br>
|
||||
|
||||
## 解题思路
|
||||
|
||||
前序遍历的第一个值为根节点的值,使用这个值将中序遍历结果分成两部分,左部分为树的左子树中序遍历结果,右部分为树的右子树中序遍历的结果。
|
||||
|
||||
<div align="center"> <img src="pics/_u91CD_u5EFA_u4E8C_u53C9_u6811-21548502782193.gif"/> </div><br>
|
||||
|
||||
```java
|
||||
// 缓存中序遍历数组每个值对应的索引
|
||||
private Map<Integer, Integer> indexForInOrders = new HashMap<>();
|
||||
|
|
BIN
docs/pics/_u91CD_u5EFA_u4E8C_u53C9_u6811-1.gif
Normal file
BIN
docs/pics/_u91CD_u5EFA_u4E8C_u53C9_u6811-1.gif
Normal file
Binary file not shown.
After Width: | Height: | Size: 6.0 KiB |
BIN
docs/pics/_u91CD_u5EFA_u4E8C_u53C9_u6811-21548502782193.gif
Normal file
BIN
docs/pics/_u91CD_u5EFA_u4E8C_u53C9_u6811-21548502782193.gif
Normal file
Binary file not shown.
After Width: | Height: | Size: 23 KiB |
Loading…
Reference in New Issue
Block a user