西大的阳光下有大洋的影子

我不上网了

剑指offer——二叉树的下一个节点

    def GetNext(self, pNode):
        # write code here
        if not pNode:
            return pNode
        if pNode.right:
            left1=pNode.right
            while left1.left:
                   left1=left1.left
            return left1
        p=pNode
        while pNode.next:
            tmp=pNode.next
            if tmp.left==pNode:
                return tmp
            pNode=tmp

  

 

posted on 2019-07-23 20:39  我不上网了  阅读(116)  评论(0编辑  收藏  举报

导航