Union Find algorithm

https://ide.codingblocks.com/s/43059
what is the error in the code?

Hey Ankur, mention the problem’s link also.

There is no any question bhaiya, just I am trying to implement union-find algo

The code is working fine. But this is not union find i suppose. This is just a graph.

sorry,I have given the wrong link. this is the actual link “https://ide.codingblocks.com/s/43151

corrected your code : https://ide.codingblocks.com/s/43156

bhaiya,it is always giving “cycle present” as output.

https://ide.codingblocks.com/s/43214

I have corrected it. Please check the comments i have added.