edited by
7,372 views
25 votes
25 votes

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$
  1. $1$, $2$ and $3$    
  2. $1$ and $2$ only    
  3. $2$ and $3$ only    
  4. $1$ and $3$ only
edited by

1 Answer

Best answer
35 votes
35 votes

Cycle detection is graph is in $P$ as it can be done using a graph traversal $(O(V+E))$

Ref: http://www.geeksforgeeks.org/detect-cycle-undirected-graph/

If a problem is in $P$ then it is also in $NP$ as $P$ is a subset of $NP$. So, both 1 and 2 are TRUE. 

Statement 3 is also true as $NP-Complete$ requires a problem to be in $NP$ and for any problem in $NP$, we have a non-deterministic polynomial time algorithm. 

So, answer is A) - 1, 2 and 3 are TRUE.  

edited by
Answer:

Related questions

44 votes
44 votes
2 answers
1