-
Notifications
You must be signed in to change notification settings - Fork 0
/
94.二叉树的中序遍历.cpp
80 lines (78 loc) · 1.35 KB
/
94.二叉树的中序遍历.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
---
title: 二叉树的中序排序
categories:
- leetcode
- leetcode题解
---
/*
* @lc app=leetcode.cn id=94 lang=cpp
*
* [94] 二叉树的中序遍历
*
* https://leetcode.cn/problems/binary-tree-inorder-traversal/description/
*
* algorithms
* Easy (75.91%)
* Likes: 1465
* Dislikes: 0
* Total Accepted: 855.6K
* Total Submissions: 1.1M
* Testcase Example: '[1,null,2,3]'
*
* 给定一个二叉树的根节点 root ,返回 它的 中序 遍历 。
*
*
*
* 示例 1:
*
*
* 输入:root = [1,null,2,3]
* 输出:[1,3,2]
*
*
* 示例 2:
*
*
* 输入:root = []
* 输出:[]
*
*
* 示例 3:
*
*
* 输入:root = [1]
* 输出:[1]
*
*
*
*
* 提示:
*
*
* 树中节点数目在范围 [0, 100] 内
* -100 <= Node.val <= 100
*
*
*
*
* 进阶: 递归算法很简单,你可以通过迭代算法完成吗?
*
*/
// @lc code=start
/**
* Definition for a binary tree node.
* struct TreeNode {
* int val;
* TreeNode *left;
* TreeNode *right;
* TreeNode() : val(0), left(nullptr), right(nullptr) {}
* TreeNode(int x) : val(x), left(nullptr), right(nullptr) {}
* TreeNode(int x, TreeNode *left, TreeNode *right) : val(x), left(left), right(right) {}
* };
*/
class Solution {
public:
vector<int> inorderTraversal(TreeNode* root) {
}
};
// @lc code=end