add DFS algorithm implementation