标签:tree ext class fat solution struct pre node val
/* struct TreeLinkNode { int val; struct TreeLinkNode *left; struct TreeLinkNode *right; struct TreeLinkNode *next; TreeLinkNode(int x) :val(x), left(NULL), right(NULL), next(NULL) { } }; */ class Solution { public: TreeLinkNode* GetNext(TreeLinkNode* pNode) { if(pNode==NULL) { return NULL; } if(pNode->right!=NULL) { pNode=pNode->right; while(pNode->left!=NULL) { pNode=pNode->left; } return pNode; } while(pNode->next!=NULL) { TreeLinkNode* father=pNode->next; if(father->left==pNode) { return father; } pNode=father; } return NULL; } };
标签:tree ext class fat solution struct pre node val
原文地址:http://www.cnblogs.com/159269lzm/p/7270010.html