start working on dfs based algorithms