Related Articles

Related Articles

GATE | GATE-CS-2014-(Set-3) | Question 23
  • Difficulty Level : Medium
  • Last Updated : 18 Apr, 2014

Suppose depth first search is executed on the graph below starting at some unknown vertex. Assume that a recursive call to visit a vertex is made only after first checking that the vertex has not been visited earlier. Then the maximum possible recursion depth (including the initial call) is _________.

(A) 17
(B) 18
(C) 19
(D) 20

Answer: (C)

Explanation: The following diagram shows the worst case situation where the recursion tree has maximum depth.


So the recursion depth is 19 (including the first node).

Quiz of this Question


My Personal Notes arrow_drop_up
Recommended Articles
Page :