contract binary tree from preorder and in order traversal