GATE CS 2014, set 1 · Question 21 · Algorithms · Multiple choice (MCQ) · 1 mark · −1/3 for a wrong answer

Let G be a graph with n vertices and m edges. What is the tightest upper bound on the running time of Depth First Search on G, when G is represented as an adjacency matrix?

  1. (A) Θ(n)
  2. (B) Θ(n+m)
  3. (C) Θ(n²)
  4. (D) Θ(m²)
Answer

Answer (C)

Answer from the official GATE CS 2014 answer key.

The step-by-step solution, where available, is part of GATE CS Pro. See what Pro includes