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.

**(A)** 1, 2 and 3

**(B)** 1 and 3

**(C)** 2 and 3

**(D)** 1 and 2

**Answer:** **(A)** **Explanation:** **1 **is true because cycle detection can be done in polynomial time using DFS (See this).

**2 **is true because P is a subset of NP.

**3 **is true because NP complete is also a subset of NP and NP means **N**on-deterministic **P**olynomial time solution exists. (See this)

Quiz of this Question

## Recommended Posts:

- Algorithms | NP Complete | Question 1
- Algorithms | NP Complete | Question 2
- Algorithms | NP Complete | Question 3
- Algorithms | NP Complete | Question 4
- Algorithms | NP Complete | Question 6
- Proof that Hamiltonian Path is NP-Complete
- Proof that vertex cover is NP complete
- Difference between NP hard and NP complete problem
- Proof that Hamiltonian Cycle is NP-Complete
- Proof that Independent Set in Graph theory is NP Complete
- Proof that Clique Decision problem is NP-Complete | Set 2
- Proof that Dominant Set of a Graph is NP-Complete
- Proof that Subgraph Isomorphism problem is NP-Complete
- Proof that Clique Decision problem is NP-Complete
- Algorithms | Analysis of Algorithms (Recurrences) | Question 1
- Algorithms | Analysis of Algorithms (Recurrences) | Question 2
- Algorithms | Analysis of Algorithms | Question 1
- Algorithms | Analysis of Algorithms (Recurrences) | Question 3
- Algorithms | Analysis of Algorithms | Question 2
- Algorithms | Analysis of Algorithms | Question 3