File tree Expand file tree Collapse file tree 1 file changed +14
-4
lines changed Expand file tree Collapse file tree 1 file changed +14
-4
lines changed Original file line number Diff line number Diff line change @@ -264,17 +264,27 @@ class Queue(object): # 借助内置的 deque 我们可以迅速实现一个 Que
264
264
- 树的遍历我们用了 print,请你尝试换成一个 callback,这样就能自定义处理树节点的方式了。
265
265
- 请问树的遍历操作时间复杂度是多少?假设它的 size 是 n
266
266
- 你能用非递归的方式来实现树的遍历吗?我们知道计算机内部使用了 stack,如果我们自己模拟如何实现?请你尝试完成
267
+ - 只根据二叉树的中序遍历和后序遍历能否确定一棵二叉树?你可以举一个反例吗?
267
268
268
269
269
270
# 延伸阅读
270
271
- 《Data Structures and Algorithms in Python》 13 章 Binary Trees
271
272
- [ https://www.geeksforgeeks.org/iterative-preorder-traversal/ ] ( https://www.geeksforgeeks.org/iterative-preorder-traversal/ )
272
273
273
274
274
- # Leetcode
275
+ # Leetcode 练习
275
276
276
- 使用树的层序遍历我们能实现一个树的左右视图,比如从一个二叉树的左边能看到哪些节点。
277
- 请你尝试做这个练习题 https://leetcode.com/problems/binary-tree-right-side-view/description/
277
+ - [ leetcode binary-tree-preorder-traversal ] ( https://leetcode.com/problems/binary-tree-preorder-traversal/ )
278
+ 二叉树的先序遍历
278
279
280
+ - [ leetcode binary-tree-inorder-traversal/] ( https://leetcode.com/problems/binary-tree-inorder-traversal/ )
281
+ 二叉树的中序遍历
282
+
283
+ - [ leetcode binary-tree-postorder-traversal] ( https://leetcode.com/problems/binary-tree-postorder-traversal/ )
284
+ 二叉树的后序遍历
285
+
286
+ - [ leetcode binary-tree-right-side-view] ( https://leetcode.com/problems/binary-tree-right-side-view/description/ )
287
+ 使用树的层序遍历我们能实现一个树的左右视图,比如从一个二叉树的左边能看到哪些节点。 请你尝试做这个练习题
288
+
289
+ - [ leetcode construct-binary-tree-from-preorder-and-postorder-traversal] ( https://leetcode.com/problems/construct-binary-tree-from-preorder-and-postorder-traversal/submissions/ )
279
290
根据二叉树的 前序和后序遍历,返回一颗完整的二叉树。
280
- https://leetcode.com/problems/construct-binary-tree-from-preorder-and-postorder-traversal/submissions/
You can’t perform that action at this time.
0 commit comments