Question

Which of the following statements are TRUE?

  1. The problem of determining whether there exists a cycle in an undirected graph is in P.
  2. The problem of determining whether there exists a cycle in an undirected graph is in NP.
  3. If a problem A is NP-Complete, there exists a non-deterministic polynomial time algorithm to solve A.
Choose one option
Official answer and solution
Official answer
A
From
Official GATE 2013 answer key

Solution

Assess graph cycle detection complexity and the relationship between complexity classes P, NP, and NPC.

Evaluate each statement:

  1. Statement 1: 'The problem of determining whether there exists a cycle in an undirected graph is in P.'

    • True. Using Depth First Search (DFS) or Breadth First Search (BFS), a cycle in an undirected graph can be detected by finding a back-edge in O(V+E)O(V + E) deterministic polynomial time.
  2. Statement 2: 'The problem of determining whether there exists a cycle in an undirected graph is in NP.'

    • True. Since P⊆NPP \subseteq NP, any problem that belongs to P is automatically in NP.
  3. Statement 3: 'If a problem A is NP-Complete, there exists a non-deterministic polynomial time algorithm to solve A.'

    • True. By definition, a problem is NP-complete if it is in NP and every problem in NP polynomial-time reduces to it. Belonging to NP means that there exists a non-deterministic polynomial-time algorithm (or a polynomial-time verifier) to solve it.

Thus, statements 1, 2, and 3 are all TRUE.

Final answer

Option (A)

Common trap

Thinking that because a problem is in P, it cannot be in NP, forgetting the fundamental set inclusion P⊆NPP \subseteq NP.

The answer is the one in the official GATE answer key. The solution is this site's own explanation.

Source

Paper
GATE 2013 Computer Science and Information Technology (CS)
Question
18 of 65, printed as CS Q.18
Section
Computer Science and Information Technology

Report an error in this question

GATE questions are the work of the organising institutes. This site is independent and is not affiliated with them.