Graph Theory37 sections · 1633 units
Open in CourseQuiz: Cycle Handling in DFS
Knowledge check
Check Your Understanding
You run DFS on a graph with cycles but forget to use a visited array. What happens?
- A.DFS skips edges that form cycles automatically
- B.DFS visits each node twice, then stops
- C.DFS enters an infinite loop (or stack overflow)
- D.DFS produces incorrect output but still terminates