solution to buildTree (pre-order and in-order)