Data Structures & AlgorithmsHardGATE CS

DFS on the directed graph with adjacency lists A: CE; B: EFG; C: B; D: AG; E: C; F: G; G: – 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 E?

  1. A. 4/5
  2. B. 2/11
  3. C. 4/6
  4. D. 5/6

Correct answer: A. 4/5

Simulating with one tick per discovery and per finish gives d[E] = 4, f[E] = 5; 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