递归解法
void traversal(TreeNode* cur,vector<int>& ret)
{
if (cur == NULL){
return;
}
traversal(cur->left,ret);
ret.push_back(cur->val);
traversal(cur->right,ret);
}
vector<int> inorderTraversal(TreeNode* root)
{
vector<int> ret;
traversal(root,ret);
return ret;
}