GATE | GATE MOCK 2017 | Question 47

You are given a graph containing n vertices and m edges and given that the graph doesn’t contain cycle of odd length. Time Complexity of the best known algorithm to find out whether the graph is bipartite or not is ?

(A) O(m+n)
(B) O(1)
(C) O(mn)
(D) O(n2)

Answer: (B)

It is by definition that a graph is bipartite iff it does not contain odd length cycles.
So the answer is O(1).
For more background reading, check this link

Quiz of this Question

My Personal Notes arrow_drop_up
Article Tags :

Be the First to upvote.

Please write to us at to report any issue with the above content.