python题解
二叉树的下一个结点
http://www.nowcoder.com/questionTerminal/9023a0c988684a53960365b889ceaf5e
class Solution: def GetNext(self, pNode): # write code here # 此节点有右子树 if pNode.right: temp = pNode.right while temp: result = temp temp = temp.left return result # 此节点没有右子树 while pNode: if pNode.next: if pNode.next.left == pNode: return pNode.next pNode = pNode.next else: return None