# Middle-题目68：106. Construct Binary Tree from Inorder and Postorder Traversal

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

struct TreeNode* buildTree(int* inorder, int inorderSize, int* postorder, int postorderSize) {
if(inorderSize == 0 && postorderSize == 0)
return NULL;
else {
int middle = postorder[postorderSize-1];
int i;
for (i = 0;inorder[i] != middle; i++);
struct TreeNode* root = (struct TreeNode*)malloc(sizeof(struct TreeNode)); //generate root
root->val = middle;
root->left = buildTree(inorder, i, postorder, i);
root->right = buildTree(&inorder[i+1], inorderSize-i-1, &postorder[i], inorderSize-i-1);
return root;
}
}

20ms,35.14%,众数20ms,43.24%
Cmershen的碎碎念：

#### 106 Construct Binary Tree from Inorder and Postorder Traversal

2015-12-09 20:29:35

#### Construct Binary Tree from Inorder and Postorder Traversal -- LeetCode

2014-04-24 09:02:17

#### 【LeetCode-面试算法经典-Java实现】【106-Construct Binary Tree from Inorder and Postorder Traversal（构造二叉树II）】

2015-08-09 06:39:31

#### LeetCode Construct Binary Tree from Inorder and Postorder Traversal 思考分析过程分享

2013-11-12 13:20:50

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

2014-12-04 23:07:11

#### 【LeetCode】105. Construct Binary Tree from Preorder and Inorder Traversal 解题报告

2016-06-01 23:42:08

#### Construct Binary Tree from Preorder and Inorder Traversal -- LeetCode

2014-04-24 08:43:09

#### [LeetCode-21]Construct Binary Tree from Preorder and Inorder Traversal

2014-05-21 05:59:08

#### 【LeetCode-面试算法经典-Java实现】【105-Construct Binary Tree from Preorder and Inorder Traversal（构造二叉树）】

2015-08-09 06:37:17

#### leetcode笔记：Construct Binary Tree from Preorder and Inorder Traversal

2015-11-30 23:54:21