标签:ret ack back null push public style rsa pop
/** * Definition for binary tree * 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> res; if(!root) return res; stack<TreeNode *> s; TreeNode * p = root; while(p || !s.empty()){ if(p){ s.push(p); p = p->left; } else{ p = s.top(); res.push_back(p->val); s.pop(); p = p->right; } } return res; } };
标签:ret ack back null push public style rsa pop
原文地址:http://www.cnblogs.com/xiuxiu55/p/6512832.html