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
全部评论
相关推荐
点赞 评论 收藏
分享
03-03 21:32
上海电机学院 产品经理 点赞 评论 收藏
分享