homework bfs dfs