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?
- A. 4/5
- B. 2/11
- C. 4/6
- 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.
Practise more Trees, Graphs, Recursion and Dynamic Programming questionsTrees, Graphs, Recursion and Dynamic Programming: notes and key points
More Trees, Graphs, Recursion and Dynamic Programming questions
- What is the minimum number of edges that must be deleted from the undirected graph with edges A–B, A–D, A–E, B–D, B–F, C–D, C–E, D–E, E–F…
- An undirected connected graph has edges A–C, B–D, B–F, B–H, C–D, C–F, D–G, D–I, E–H, F–G. How many articulation points (cut vertices) and…
- Coins of denominations 1, 9, 10, 11 are available in unlimited supply. What is the minimum number of coins needed to make 18, and how many…
- A BST holds integer keys between 1 and 100. Which sequence CANNOT be the sequence of keys examined while searching for 46?
- Dijkstra's algorithm runs from A on the directed graph A→B (6), A→E (1), A→F (11), B→C (9), B→D (2), B→F (1), C→D (10), C→F (11), D→A (5)…
- With 3 identical eggs and at most 7 drops, what is the largest number of floors for which you can always determine the critical floor (the…