Code not working for bipartite checker

code-https://ide.codingblocks.com/s/314938

kindly reply its been almost a day

@amanb25
There was a slight issue in your code. When you were constructing your adjacency matrix, you performed the following step:
l=new list[V];

This is incorrect because you have five nodes in your test graph, but using this method, the indexes would range from 0 to 4. If you wish to insert an edge containing 5 as one of the nodes, it wouldnt work because 5th index does not exist, it ranges from 0 to 4 in the adjacency matrix.

l=new list[V + 1];
Use the above tweak and I hope your code will work just fine.

If my answer is able to resolve your query, please mark the doubt as resolved.

1 Like

I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.

On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.