Tuesday, September 30, 2014

Construct Binary Tree from Preorder and Inorder Traversal

Problem

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

Idea

Preorder那个数组找到根,inorder那个数组找到根的位置,然后左边为左子树,右边为右子树。

Solution


No comments:

Post a Comment