Breadth First Search

Consider the following statements regarding the BFS (Breadth-First Search) and DFS (Depth-First Search) algorithms in an undirected graph. Identify which of the statements below are false:

I. Both BFS and DFS can be utilized to check if a graph is connected.

II. DFS can potentially get caught in a cycle, whereas BFS is immune to this issue.

III. DFS is guaranteed to find the shortest path between two vertices, if such a path exists.

IV. BFS always finds the shortest path (in terms of the number of edges) between any two vertices, if such a path exists.

a) I
b) II
c) II and III
d) II and IV
e) None of the above

Original Idea: Matheus Lindino

Comentários

  1. Nice question, but the phrase "can potentially be caught in a cycle" is not clear enough, I'm afraid. I'll have to discard your question.

    ResponderExcluir

Postar um comentário

Postagens mais visitadas deste blog

Depth-first search Question

Calculus