mirror of
https://github.com/youngyangyang04/leetcode-master.git
synced 2025-07-28 19:53:10 +08:00
Update
This commit is contained in:
22
README.md
22
README.md
@ -1,6 +1,6 @@
|
||||
# 算法面试思维导图:
|
||||
|
||||

|
||||

|
||||
|
||||
# 算法文章精选:
|
||||
|
||||
@ -125,6 +125,17 @@ void kmp(int* next, const string& s){
|
||||
|
||||
## 二叉树
|
||||
|
||||
二叉树的定义:
|
||||
|
||||
```
|
||||
struct TreeNode {
|
||||
int val;
|
||||
TreeNode *left;
|
||||
TreeNode *right;
|
||||
TreeNode(int x) : val(x), left(NULL), right(NULL) {}
|
||||
};
|
||||
```
|
||||
|
||||
### 深度优先遍历(递归)
|
||||
|
||||
前序遍历(中左右)
|
||||
@ -261,6 +272,15 @@ vector<vector<int>> levelOrder(TreeNode* root) {
|
||||
|
||||
```
|
||||
|
||||
可以直接解决如下题目:
|
||||
|
||||
* [0102.二叉树的层序遍历](https://github.com/youngyangyang04/leetcode/blob/master/problems/0102.二叉树的层序遍历.md)
|
||||
* [0199.二叉树的右视图](https://github.com/youngyangyang04/leetcode/blob/master/problems/0199.二叉树的右视图.md)
|
||||
* [0104.二叉树的最大深度 (迭代法的版本)](https://github.com/youngyangyang04/leetcode/blob/master/problems/0104.二叉树的最大深度.md)
|
||||
|
||||
* 0111.二叉树的最小深度(迭代法的版本)
|
||||
* 0222.完全二叉树的节点个数(迭代法的版本)
|
||||
|
||||
### 二叉树深度
|
||||
|
||||
```
|
||||
|
Reference in New Issue
Block a user