Questions: Depth-First Search (DFS)

3 questions to test your understanding

Score: 0 / 3
Question 1 Multiple Choice

During DFS on a directed graph, you visit node A, then B, then C — and from C you find an edge back to A, which is still on the current recursion stack. What type of edge is this, and what does it indicate?

AA tree edge — it is part of the DFS spanning tree
BA back edge — it indicates a cycle in the directed graph
CA cross edge — it connects two unrelated branches
DA forward edge — it points to a descendant already fully processed
Question 2 True / False

DFS is a good algorithm for finding the shortest path between two nodes in an unweighted graph.

TTrue
FFalse
Question 3 Short Answer

What is the time complexity of DFS on a graph with V vertices and E edges, and why?

Think about your answer, then reveal below.