def lmr_f(self,root):
stack=[]
while root is not None or len(stack)!=0:
if root is not None:
stack.append(root)
root=root.left
else:
root=stack.pop()
result2.append(root.val)
root=root.right
stack=[]
while root is not None or len(stack)!=0:
if root is not None:
stack.append(root)
root=root.left
else:
root=stack.pop()
result2.append(root.val)
root=root.right
全部评论
相关推荐
点赞 评论 收藏
分享

点赞 评论 收藏
分享
06-12 19:52
吉首大学张家界学院 Python 点赞 评论 收藏
分享