Given preorder and inorder traversal of a tree, construct the binary tree.
Note:
You may assume that duplicates do not exist in the tree.
You may assume that duplicates do not exist in the tree.
Solution:
Basic binary tree question, but need to take care of boundary of array index.
Round2 solution:
Following solution is shorter, though result in a Memory Limit Exceeded.
No comments:
Post a Comment