美文网首页
106 Construct Binary Tree from I

106 Construct Binary Tree from I

作者: 烟雨醉尘缘 | 来源:发表于2019-02-26 15:47 被阅读0次

Given inorder and postorder traversal of a tree, construct the binary tree.

Example:

inorder:[9,3,15,20,7]
postorder:[9,15,7,20,3]
output :[3,9,20,null,null,15,7]

解释下题目:

给定先序遍历和后序遍历的,求符合要求的二叉树。

1. D&C

实际耗时:1ms

//等优化后再来写
踩过的坑:

  思路

时间复杂度O(n^2)
空间复杂度O(1)

相关文章

网友评论

      本文标题:106 Construct Binary Tree from I

      本文链接:https://www.haomeiwen.com/subject/zkgayqtx.html