Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 872deab

Browse files
Merge pull request youngyangyang04#2806 from gazeldx/binary_tree_recursive
二叉树的递归遍历.md 去掉 Python 版本中无用的代码;修复一处说明错误:`队列出口的元素` 改为 `队列入口的元素`.
2 parents 9e02bd0 + dcbd5b4 commit 872deab

File tree

2 files changed

+2
-4
lines changed

2 files changed

+2
-4
lines changed

‎problems/二叉树的迭代遍历.md‎

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -262,8 +262,6 @@ class Solution:
262262
# 中序遍历-迭代-LC94_二叉树的中序遍历
263263
class Solution:
264264
def inorderTraversal(self, root: TreeNode) -> List[int]:
265-
if not root:
266-
return []
267265
stack = [] # 不能提前将root结点加入stack中
268266
result = []
269267
cur = root
@@ -280,7 +278,7 @@ class Solution:
280278
cur = cur.right
281279
return result
282280
```
283-
```python
281+
```python
284282

285283
# 后序遍历-迭代-LC145_二叉树的后序遍历
286284
class Solution:

‎problems/栈与队列总结.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ cd a/b/c/../../
107107
设计单调队列的时候,pop,和push操作要保持如下规则:
108108

109109
1. pop(value):如果窗口移除的元素value等于单调队列的出口元素,那么队列弹出元素,否则不用任何操作
110-
2. push(value):如果push的元素value大于入口元素的数值,那么就将队列出口的元素弹出,直到push元素的数值小于等于队列入口元素的数值为止
110+
2. push(value):如果push的元素value大于入口元素的数值,那么就将队列入口的元素弹出,直到push元素的数值小于等于队列入口元素的数值为止
111111

112112
保持如上规则,每次窗口移动的时候,只要问que.front()就可以返回当前窗口的最大值。
113113

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /