class BinaryTreeNode():
def __init__(self,value=None,left=None,right=None):
self.value=value
self.left=left
self.right=right
def Convert_(pRoot):
pLastNodeInList=None
Convert(pRoot,pLastNodeInList)
pHeadlist=pLastNodeInList
while pHeadlist is not None and pHeadlist.left is not None:
pHeadlist=pHeadlist.left
return pHeadlist
def Convert(pNode,pLastNodeInList):
if pNode is None:
return
pCurrent=pNode
if pCurrent.left is not None:
Convert(pCurrent.left,pLastNodeInList)
pCurrent.left=pLastNodeInList
if pLastNodeInList.right is not None:
pLastNodeInList.right=pCurrent
pLastNodeInList=pCurrent
if pCurrent.right is not None:
Convert(pCurrent.left,pLastNodeInList)
07-20
298
![](https://csdnimg.cn/release/blogv2/dist/pc/img/readCountWhite.png)
“相关推荐”对你有帮助么?
-
非常没帮助
-
没帮助
-
一般
-
有帮助
-
非常有帮助
提交