/* struct TreeNode { int val; struct TreeNode *left; struct TreeNode *right; TreeNode(int x) : val(x), left(NULL), right(NULL) { } };*/ class Solution { public: TreeNode *head = NULL; TreeNode *tail = NULL; TreeNode* Convert(TreeNode* pRootOfTree) { midBL(pRootOfTree); return tail; } // 中序遍历 void midBL(TreeNode * cur) { if(cur == NULL) return; midBL(cur->left); if(head == NULL) { head = cur; tail = cur; } else { head->right = cur; cur->left = head; head = cur; } midBL(cur->right); } };