5 5 votes Consider the following statements: Checking if a given $undirected$ graph has a cycle is in $\mathsf{P}$ Checking if a given $undirected$ graph has a cycle is in $\mathsf{NP}$ Checking if a given $directed$ graph has a cycle is in $\mathsf{P}$ Checking if a given $directed$ graph has a cycle is in $\mathsf{NP}$ Which of the above statements is/are TRUE? Choose from the following options. Only i and ii Only ii and iv Only ii, iii, and iv Only i, ii and iv All of them Algorithms tifr2017 algorithms graph-algorithms p-np-npc-nph + – go_editor 1.7k views answer comment Share Follow Print 0 reply Please log in or register to add a comment.
Best answer 11 11 votes E. All of them. Because all of them can be solved by Depth first traversal. Every P problem is a subset of NP. Anusha Motamarri answered Dec 23, 2016 • edited Nov 6, 2017 by kenzou Anusha Motamarri comment Share Follow See all 2 Comments 2 2 Comments reply thor commented Dec 23, 2016 reply Follow flag is it in gate syllabus? 0 0 replyShare Arjun commented Dec 24, 2016 reply Follow flag yes. 0 0 replyShare Please log in or register to add a comment.