Daily Archives: June 15, 2015

[leetcode] Construct Binary Tree from Preorder and Inorder Traversal

Given preorder and inorder traversal of a tree, construct the binary tree. Note: You may assume that duplicates do not exist in the tree. Show Tags //preorder储存数字信息 //inorder存储结构信息 //每次inorder都会把数平分成两半 //注意不要内存超界。 /** * Definition for a binary tree node. * struct TreeNode { * int val; * TreeNode *left; * TreeNode […]