文件名称:
README.md
所在目录:
教材与参考资料 / 程序设计类 / 数据结构&算法 / 算法 / 面试与力扣题目详解 / Leetcode题目和解答 / java-leetcode / binary-tree-upside-down
文件大小:
565.00 B
下载地址:
文本预览:
## $ 15
This is the first paid problem ever. `Nov 17`
## Inorder travel
I found it just looks like result of an inorder travel on the tree
```
1
/ \
2 3
/ \
4 5
```
Inorder: 4 2 5 1 3
Result:
```
4
/ \
5 2
/ \
3 1
```
we can build the new tree using the inorder result easily.
### Difference from regular inorder travel
* No need to inorder right child, because it must be leaf or empty
* Empty right child should be added to the result if left child is not empty. This is to recovery the empty node in the new tree.
This is the first paid problem ever. `Nov 17`
## Inorder travel
I found it just looks like result of an inorder travel on the tree
```
1
/ \
2 3
/ \
4 5
```
Inorder: 4 2 5 1 3
Result:
```
4
/ \
5 2
/ \
3 1
```
we can build the new tree using the inorder result easily.
### Difference from regular inorder travel
* No need to inorder right child, because it must be leaf or empty
* Empty right child should be added to the result if left child is not empty. This is to recovery the empty node in the new tree.
点赞
回复
X