dfs, iteration with stack and morris traversal