标签:node 二叉树 遍历 题目 pytho 返回 turn binary none
# 返回构造的TreeNode根节点
def re_construct_binary_tree(pre, tin):
if not pre or not tin:
return None
root = TreeNode(pre.pop())
index = tin.index(root.val)
root.left = self.reConstructBinaryTree(pre, tin[:index])
root.right = self.reConstructBinaryTree(pre, tin[index + 1:])
return root
标签:node 二叉树 遍历 题目 pytho 返回 turn binary none
原文地址:https://www.cnblogs.com/rnanprince/p/11588434.html