File tree Expand file tree Collapse file tree 2 files changed +3
-1
lines changed Expand file tree Collapse file tree 2 files changed +3
-1
lines changed Original file line number Diff line number Diff line change 107
107
* [ 二叉树:以为使用了递归,其实还隐藏着回溯] ( https://mp.weixin.qq.com/s/ivLkHzWdhjQQD1rQWe6zWA )
108
108
* [ 二叉树:做了这么多题目了,我的左叶子之和是多少?] ( https://mp.weixin.qq.com/s/gBAgmmFielojU5Wx3wqFTA )
109
109
* [ 二叉树:我的左下角的值是多少?] ( https://mp.weixin.qq.com/s/MH2gbLvzQ91jHPKqiub0Nw )
110
+ * [ 二叉树:递归函数究竟什么时候需要返回值,什么时候不要返回值?] ( https://mp.weixin.qq.com/s/6TWAVjxQ34kVqROWgcRFOg )
110
111
* [ 二叉树:构造二叉树登场!] ( https://mp.weixin.qq.com/s/7r66ap2s-shvVvlZxo59xg )
112
+ * [ 二叉树:构造一棵最大的二叉树] ( https://mp.weixin.qq.com/s/1iWJV6Aov23A7xCF4nV88w )
111
113
112
114
113
115
Original file line number Diff line number Diff line change @@ -113,7 +113,7 @@ public:
113
113
## 迭代法
114
114
115
115
116
- 本题使用了后序遍历啊, 那么参考文章 [ 二叉树:听说递归能做的,栈也能做!] ( https://mp.weixin.qq.com/s/c_zCrGHIVlBjUH_hJtghCg ) 和[ 二叉树:前中后序迭代方式的写法就不能统一一下么?] ( https://mp.weixin.qq.com/s/WKg0Ty1_3SZkztpHubZPRg ) 中的写法,同样可以写出一个后序遍历的迭代法 。
116
+ 本题迭代法使用前中后序都是可以的,只要把左叶子节点统计出来,就可以了, 那么参考文章 [ 二叉树:听说递归能做的,栈也能做!] ( https://mp.weixin.qq.com/s/c_zCrGHIVlBjUH_hJtghCg ) 和[ 二叉树:前中后序迭代方式的写法就不能统一一下么?] ( https://mp.weixin.qq.com/s/WKg0Ty1_3SZkztpHubZPRg ) 中的写法,可以写出一个前序遍历的迭代法 。
117
117
118
118
判断条件都是一样的,代码如下:
119
119
You can’t perform that action at this time.
0 commit comments