Question discussion

A directed graph has the adjacency lists A: B, C; B: D; C: D, E; D: F; E: F; F: (none). A depth-first search starts at A and visits neighbo…

1142Medium DSSSB TGT Computer Science 0 replies 1 views
0

A directed graph has the adjacency lists A: B, C; B: D; C: D, E; D: F; E: F; F: (none). A depth-first search starts at A and visits neighbours in the listed order. What is the order of visiting?

  • AA B C D E F
  • BA B D F C E
  • CA C E F D B
  • DA B D C E F
Correct answer: B

Explanation

DFS goes A → B → D → F, backtracks to A, then goes C → (D already visited) → E, giving A B D F C E.

Discussion 0

Nobody has replied yet. Start the discussion!