Open In App
Related Articles

GATE | GATE CS 2013 | Question 18

Improve Article
Improve
Save Article
Save
Like Article
Like

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 2 only
(C) 2 and 3 only
(D) 1 and 3 only


Answer: (A)

Explanation: 1. We can either use BFS or DFS to find whether there is a cycle in an undirected graph. For example, see DFS based implementation to detect cycle in an undirected graph. The time complexity is O(V+E) which is polynomial.

2. If a problem is in P, then it is definitely in NP (can be verified in polynomial time). See NP-Completeness

3. True. See See NP-Completeness


Quiz of this Question

Level Up Your GATE Prep!
Embark on a transformative journey towards GATE success by choosing Data Science & AI as your second paper choice with our specialized course. If you find yourself lost in the vast landscape of the GATE syllabus, our program is the compass you need.

Last Updated : 28 Jun, 2021
Like Article
Save Article
Previous
Next
Similar Reads