RECOVER BST

solved with O(N) space