Check whether a given graph is Bipartite or not

Question

Quick Hints

  • If a graph has odd cycle length it cannot be bipartite

Solution

Time complexity

  • Same time complexity as BFS
  • O (n * n) for adjancency matrix O (V + E) for adjancency list

Space complexity

Notes