Data Structures & AlgorithmsHardGATE CS

DFS on the directed graph with adjacency lists A: BE; B: –; C: AD; D: AG; E: DF; F: D; G: E starts at A (scanning lists in the order shown, restarting from the alphabetically first unvisited vertex), with a clock that ticks on every discovery and every finish starting at 1. What are the discovery and finish times of F?

  1. A. 9/10
  2. B. 3/8
  3. C. 9/11
  4. D. 10/11

Correct answer: A. 9/10

Simulating with one tick per discovery and per finish gives d[F] = 9, f[F] = 10; the interval [d, f] of a vertex contains exactly the intervals of its DFS descendants.

More Trees, Graphs, Recursion and Dynamic Programming questions

Exams that ask this topic