Merge pull request #2512 from gggxxxx/XiongGu-branch
Add dfs function execution in the tree traversal (Python)
This commit is contained in:
commit
73f99045f2
|
|
@ -190,6 +190,7 @@ class Solution:
|
||||||
dfs(node.left)
|
dfs(node.left)
|
||||||
dfs(node.right)
|
dfs(node.right)
|
||||||
|
|
||||||
|
dfs(root)
|
||||||
return res
|
return res
|
||||||
|
|
||||||
```
|
```
|
||||||
|
|
@ -207,6 +208,7 @@ class Solution:
|
||||||
res.append(node.val)
|
res.append(node.val)
|
||||||
dfs(node.right)
|
dfs(node.right)
|
||||||
|
|
||||||
|
dfs(root)
|
||||||
return res
|
return res
|
||||||
```
|
```
|
||||||
```python
|
```python
|
||||||
|
|
@ -225,6 +227,7 @@ class Solution:
|
||||||
dfs(node.right)
|
dfs(node.right)
|
||||||
res.append(node.val)
|
res.append(node.val)
|
||||||
|
|
||||||
|
dfs(root)
|
||||||
return res
|
return res
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue