use a map to memorize visited tree nodes. 1st visit go down, 2nd visit go up