Skip to content

Commit a41a7ba

Browse files
longsizhuogithub-actions[bot]
authored andcommitted
chore(docs): sync doc metadata [skip ci]
1 parent 8a3d3f0 commit a41a7ba

File tree

2 files changed

+87
-66
lines changed

2 files changed

+87
-66
lines changed

app/docs/CommunityShare/Leetcode/538.把二叉搜索树转换为累加树_translated.md

Lines changed: 65 additions & 61 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,12 @@
11
---
22
title: 538.Convert the binary search tree to cumulative tree
3-
date: '2024.01.01 0:00'
3+
date: "2024.01.01 0:00"
44
tags:
55
- - Python
66
- - answer
77
- - Binary tree
88
abbrlink: 32401b69
9+
docId: wen0bbo8m93oih1mx6sva9sh
910
---
1011

1112
# topic:
@@ -86,73 +87,76 @@ There is a clever way to be online,只占用常数空间来实现中序Travers
8687
2 3
8788
/ \
8889
4 5
89-
9090
```
91+
9192
1. Initialization The current node is the root node(current = 1)。
9293

9394
2. When the current node is not empty,Execute the following steps:
94-
9595
1. The left node of the current node is not empty。We find the front -drive node of the current node,也就是左子Tree中的最右节点。exist这个例子中,The front -drive node is the node5。
9696
2. The right node of the front -drive node is empty,Point your right node to the current node(5 -> 1)。
9797
3. Move the current node to its left child node(current = 2)。
98-
```markdown
99-
1
100-
\
101-
2
102-
/ \
103-
4 5
104-
```
105-
106-
1. The left node of the current node is not empty。We find the front -drive node of the current node,也就是左子Tree中的最右节点。exist这个例子中,The front -drive node is the node4。
107-
2. The right node of the front -drive node is empty,Point your right node to the current node(4 -> 2)。
108-
3. Move the current node to its left child node(current = 4)。
109-
```markdown
110-
1
111-
\
112-
2
113-
\
114-
4
115-
\
116-
5
117-
118-
```
119-
120-
1. The left node of the current node is empty。Output当前节点的值(4)。
121-
122-
2. Move the current node to its right node(current = 5)。
123-
124-
3. The left node of the current node is empty。Output当前节点的值(5)。
125-
126-
4. Move the current node to its right node(current = 2)。
127-
```markdown
128-
1
129-
\
130-
2
131-
\
132-
4
133-
```
134-
1. The left node of the current node is empty。Output当前节点的值(2)。
135-
2. Move the current node to its right node(current = 1)。
136-
```markdown
137-
1
138-
\
139-
2
140-
```
141-
1. The left node of the current node is empty。Output当前节点的值(1)。
142-
2. Move the current node to its right node(current = 3)。
143-
```markdown
144-
1
145-
\
146-
2
147-
```
148-
1. The left node of the current node is empty。Output当前节点的值(3)。
149-
2. Move the current node to its right node(current = null)。
150-
3. The current node is empty,Traversal结束。
151-
4.
152-
According to the above steps,通过修改节点between的指针关系,我们完成了对Binary tree的中序Traversal。
15398

99+
```markdown
100+
1
101+
\
102+
2
103+
/ \
104+
4 5
105+
```
106+
107+
1. The left node of the current node is not empty。We find the front -drive node of the current node,也就是左子Tree中的最右节点。exist这个例子中,The front -drive node is the node4。
108+
2. The right node of the front -drive node is empty,Point your right node to the current node(4 -> 2)。
109+
3. Move the current node to its left child node(current = 4)。
110+
111+
```markdown
112+
1
113+
\
114+
2
115+
\
116+
4
117+
\
118+
5
119+
```
120+
121+
1. The left node of the current node is empty。Output当前节点的值(4)。
122+
2. Move the current node to its right node(current = 5)。
123+
3. The left node of the current node is empty。Output当前节点的值(5)。
124+
4. Move the current node to its right node(current = 2)。
125+
126+
```markdown
127+
1
128+
\
129+
2
130+
\
131+
4
132+
```
133+
134+
1. The left node of the current node is empty。Output当前节点的值(2)。
135+
2. Move the current node to its right node(current = 1)。
136+
137+
```markdown
138+
1
139+
\
140+
2
141+
```
142+
143+
1. The left node of the current node is empty。Output当前节点的值(1)。
144+
2. Move the current node to its right node(current = 3)。
145+
146+
```markdown
147+
1
148+
\
149+
2
150+
```
151+
152+
1. The left node of the current node is empty。Output当前节点的值(3)。
153+
2. Move the current node to its right node(current = null)。
154+
155+
3. The current node is empty,Traversal结束。
156+
4. According to the above steps,通过修改节点between的指针关系,我们完成了对Binary tree的中序Traversal。
154157

155158
# Code:
159+
156160
```python 中序Traversal
157161
class Solution:
158162
def convertBST(self, root: TreeNode) -> TreeNode:
@@ -163,7 +167,7 @@ class Solution:
163167
total += root.val
164168
root.val = total
165169
dfs(root.left)
166-
170+
167171
total = 0
168172
dfs(root)
169173
return root
@@ -178,7 +182,7 @@ class Solution:
178182
while succ.left and succ.left != node:
179183
succ = succ.left
180184
return succ
181-
185+
182186
total = 0 # 记录累加的节点值之and
183187
node = root # The current node initialization is the root node
184188

@@ -220,4 +224,4 @@ class Solution:
220224

221225
convert(root, 0)
222226
return root
223-
```
227+
```

generated/doc-contributors.json

Lines changed: 22 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
{
22
"repo": "InvolutionHell/involutionhell",
3-
"generatedAt": "2025-11-29T03:05:48.113Z",
3+
"generatedAt": "2025-11-30T03:06:24.054Z",
44
"docsDir": "app/docs",
5-
"totalDocs": 127,
5+
"totalDocs": 128,
66
"results": [
77
{
88
"docId": "ue27z7z95yzw3lhhfj7nit1c",
@@ -2225,13 +2225,13 @@
22252225
"docId": "hiqhki2z4v6oy0jstrcs7im0",
22262226
"path": "app/docs/CommunityShare/Leetcode/2335. 装满杯子需要的最短总时长_translated.md",
22272227
"contributorStats": {
2228-
"114939201": 1
2228+
"114939201": 2
22292229
},
22302230
"contributors": [
22312231
{
22322232
"githubId": "114939201",
2233-
"contributions": 1,
2234-
"lastContributedAt": "2025-11-29T03:00:32.000Z",
2233+
"contributions": 2,
2234+
"lastContributedAt": "2025-11-29T03:05:49.000Z",
22352235
"login": "longsizhuo",
22362236
"avatarUrl": "https://avatars.githubusercontent.com/u/114939201?v=4",
22372237
"htmlUrl": "https://github.com/longsizhuo"
@@ -2289,6 +2289,23 @@
22892289
}
22902290
]
22912291
},
2292+
{
2293+
"docId": "wen0bbo8m93oih1mx6sva9sh",
2294+
"path": "app/docs/CommunityShare/Leetcode/538.把二叉搜索树转换为累加树_translated.md",
2295+
"contributorStats": {
2296+
"114939201": 1
2297+
},
2298+
"contributors": [
2299+
{
2300+
"githubId": "114939201",
2301+
"contributions": 1,
2302+
"lastContributedAt": "2025-11-30T03:00:04.000Z",
2303+
"login": "longsizhuo",
2304+
"avatarUrl": "https://avatars.githubusercontent.com/u/114939201?v=4",
2305+
"htmlUrl": "https://github.com/longsizhuo"
2306+
}
2307+
]
2308+
},
22922309
{
22932310
"docId": "ryp6s59uwc10w2dywgs6f66h",
22942311
"path": "app/docs/CommunityShare/Leetcode/80_translated.md",

0 commit comments

Comments
 (0)