Breadth First Search

1. Which of the following is a use of the extra 'visited' array in BFS?
Explanation

Explanation

Explanation

Explanation

Explanation

Explanation

Explanation

Explanation

2. What would happen if a stack were used instead of a queue to control the order of vertex processing in a standard graph traversal?
Explanation

Explanation

Explanation

Explanation

Explanation

Explanation

Explanation

Explanation

3. Why is the time complexity of BFS O(V+E)O(|V| + |E|) when an adjacency-list representation is used?
Explanation

Explanation

Explanation

Explanation

Explanation

Explanation

Explanation

Explanation

4. Consider the following graph:
Vertices, V = [a, b, c, d, e, f]
Edges, E = [[a, b], [a, c], [b, d], [b, e], [c, e], [c, f]]
Where each array within E signifies an edge between the two mentioned vertices and 'a' is the root.
Which of the following represents the correct sequence of the queue during BFS, assuming a vertex is marked visited when it is first added to the queue?
Explanation

Explanation

Explanation

Explanation

Explanation

Explanation

Explanation

Explanation

5. In an unweighted graph, what does the BFS level of a vertex represent relative to the source vertex?
Explanation

Explanation

Explanation

Explanation

Explanation

Explanation

Explanation

Explanation

6. Which of the following best explains why BFS processes a graph level by level?
Explanation

Explanation

Explanation

Explanation

Explanation

Explanation

Explanation

Explanation

7. Suppose a connected graph contains V|V| vertices. During a BFS traversal starting from one source, each vertex other than the source is assigned exactly one BFS-tree parent. How many edges are present in the resulting BFS tree?
Explanation

Explanation

Explanation

Explanation

Explanation

Explanation

Explanation

Explanation

8. If BFS is started from a vertex in a disconnected graph, what will happen?
Explanation

Explanation

Explanation

Explanation

Explanation

Explanation

Explanation

Explanation

9. Consider two vertices uu and vv in an unweighted graph. BFS discovers uu at level 2 and discovers vv directly from uu. Assuming vv has not been visited before, at which level will vv be placed?
Explanation

Explanation

Explanation

Explanation

Explanation

Explanation

Explanation

Explanation