The GATE Grind

GATE 2013 CS (CS1) – Question 28

Theory of Computation · Turing Machines and Undecidability · 1 mark · Multiple choice

Which are true? 1: Undirected cycle detection is in P. 2: Undirected cycle detection is in NP. 3: Every NP-complete problem has a nondeterministic polynomial-time algorithm.

  1. 1,2,3
  2. 1,2 only
  3. 2,3 only
  4. 1,3 only

Practise this question in The GATE Grind →

Show answer and explanation

Correct answer: (A) 1,2,3

Explanation

DFS detects an undirected cycle in linear graph time, so the decision problem is in P and therefore also in NP. By definition NP-complete problems belong to NP, which supplies a nondeterministic polynomial-time algorithm. All three statements hold, A.

More Turing Machines and Undecidability questions

All Turing Machines and Undecidability questions →