Generating tree from preorder and inorder