In the case of the same parent for both nodes, why is 1 coming in the output?
Output 1 in cycle detection
Hello @sonalbera have you given any colour component or anything for the pattern?
because yes if the parent are same then the output will be same for the components in that particular graph.
if you have doubt you can ask here.
Happy Learning!!
It’s not in my code. I’m talking about the video DSU-04 where Prateek bhaiya does the coding. There an extra 1 comes in output even though it shouldnt.
@sonalbera try to see the video then there must be where he is forming the superparent for the nodes or uniting them then they must belong to the same connected component.
you will understand that he usually also explains the ouput again.
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.