# //stack

vector\<int> inorderTraversal(TreeNode\* root) {

stack\<TreeNode\*> s;

vector\<int> ret;

TreeNode \*p=root;

while(p||!s.empty()){

if(p){

s.push(p);

p=p->left;

}else{

p=s.top();

s.pop();

ret.push\_back(p->val);

p=p->right;

}

}

return ret;

}
