Merge pull request #270 from zy6p/patch-1

Update 算法模板.md
This commit is contained in:
Carl Sun 2021-05-27 15:37:19 +08:00 committed by GitHub
commit f83ca366ea
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 2 additions and 2 deletions

View File

@ -82,13 +82,13 @@ void traversal(TreeNode* cur, vector<int>& vec) {
traversal(cur->right, vec); // 右
}
```
前序遍历(中左右
后序遍历(左右中
```
void traversal(TreeNode* cur, vector<int>& vec) {
if (cur == NULL) return;
vec.push_back(cur->val); // 中 ,同时也是处理节点逻辑的地方
traversal(cur->left, vec); // 左
traversal(cur->right, vec); // 右
vec.push_back(cur->val); // 中 ,同时也是处理节点逻辑的地方
}
```