build tree from inorder and preorder traversal