94. Binary Tree Inorder Traversa
来源:互联网 发布:2016年淘宝双11抢红包 编辑:程序博客网 时间:2024/06/15 19:05
/** * Definition for a binary tree node. * struct TreeNode { * int val; * TreeNode *left; * TreeNode *right; * TreeNode(int x) : val(x), left(NULL), right(NULL) {} * }; */class Solution {public: vector<int> inorderTraversal(TreeNode* root) { vector<int> ret; stack<TreeNode*> s; TreeNode *p=root; while(p||!s.empty()) { if(p) { s.push(p); p=p->left; } else { p=s.top(); ret.push_back(p->val); s.pop(); p=p->right; } } return ret; }};
0 0
- 94. Binary Tree Inorder Traversa
- Binary Tree Inorder Traversa
- [LeetCode] Binary Tree Inorder Traversa
- [leetcode 94]Binary Tree Inorder Traversa
- Construct Binary Tree from Inorder and Postorder Traversa
- 145. Binary Tree Postorder Traversa
- leetcode-Binary Tree Zigzag Level Order Traversa
- Leetcode 314 Binary Tree Vertical Order Traversa
- 94. Binary Tree Inorder Traversal
- 94.Binary Tree Inorder Traversal
- 94. Binary Tree Inorder Traversal
- 94.Binary Tree Inorder Traversal
- 94. Binary Tree Inorder Traversal
- 94. Binary Tree Inorder Traversal
- 94. Binary Tree Inorder Traversal
- 94. Binary Tree Inorder Traversal
- 94. Binary Tree Inorder Traversal
- 94. Binary Tree Inorder Traversal
- 顺序表应用3:元素位置互换之移位算法
- 学习HTML与CSS
- ios 开发学习日志 自定义alertView 2
- Android源代码分析要看的书
- MySQL更新用户密码
- 94. Binary Tree Inorder Traversa
- 顺序表应用4:元素位置互换之逆置算法
- GPDB查看表分布策略信息
- github常见操作和常见错误!
- Activiti(一)--基础
- HDU 3478 Catch
- 求单向链表中的倒数第K个节点2
- 今夜,中国华为竟然把美国苹果逼上了绝路
- 程序的内存分配