reconstruct tree from preorder traversal