Skip to content

Commit 6b83b30

Browse files
committed
tree 层序
1 parent fcd3134 commit 6b83b30

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

docs/14_树与二叉树/tree.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -195,6 +195,10 @@ btree.preorder_trav(btree.root) # 输出 A, B, D, E, H, C, F, G, I, J
195195
```
196196
怎么样是不是挺简单的,比较直白的递归函数。如果你不明白,视频里我们会画个图来说明。
197197

198+
# 二叉树层序遍历
199+
200+
除了递归的方式遍历之外,我们还可以使用层序遍历的方式。程序遍历比较直白,就是从根节点开始按照一层一层的方式区遍历节点。
201+
198202
# 反转二叉树
199203
之所以单拎出来说这个是因为 mac 下著名的 brew 工具作者据说是因为面试 google 白板编程没写出来反转二叉树跪了。然后人家就去了苹果 😂。其实吧和遍历操作相比也没啥太大区别,递归交换就是了:
200204

0 commit comments

Comments
 (0)