Final answer:
Both BFS and DFS can be used to find if there is a path from s to t in a connected graph G. Hence the correct answer is option 3
Step-by-step explanation:
Both BFS (Breadth First Search) and DFS (Depth First Search) can be used to find if there is a path from s to t in a connected graph G.
In BFS, we start at vertex s and explore all its neighbors before moving to the next level of vertices. If we find the vertex t during the traversal, we can conclude that there is a path from s to t.
In DFS, we explore one branch of the graph as deeply as possible before backtracking. We continue this process until we either find t or reach a dead end. If we find t during the traversal, we can conclude that there is a path from s to t.
Therefore, the correct answer is 3) Both BFS and DFS.