in Programming
281 views
1 vote
1 vote
Choose the correct option, from the following:

I) We can find the cycle in the graph using BFS.
II) We can find the cycle in the graph using DFS.

III)Both Correct

IV)Both wrong
in Programming
281 views

4 Comments

Both can be used to find cycle in graph .
1
1
I also gave the option (III) but answers is(II).
Explanation provided is that  BFS is bad choice when graph is directed.
But as in question it's nowhere mentioned about type of grpah so i think option(III) is correct.

Correct me if I am wrong.
0
0
even in directed graph, both BFS and DFS can detect cycle.
0
0
Back edges are used to detect cycles. We find back edges in BFS and DFS both. So both are correct.
0
0

Please log in or register to answer this question.

Related questions

0 votes
0 votes
0 answers
4
Na462 asked in CO and Architecture Sep 24, 2018
289 views
Na462 asked in CO and Architecture Sep 24, 2018
by Na462
289 views