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 _________.

GATECS2014Q20
(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.

GATECS2014Q20Sol

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

Quiz of this Question

sudo-gate-course

My Personal Notes arrow_drop_up
Recommended Articles
Page :