Pairing code ouput

Here I am trying to group elements in same set by assiging them same value as parent and than calculating total combination but I don’t understand why didn’t my parent array is getting updated here
code Link : https://ide.codingblocks.com/s/196462

Hi @Divya_321

In lines 50 and 56 instead of compare sign(==) you need to use assignment operator (=).

Hope it Helps.

@Nayan04 I have corrected line no. 50 and 56 but now every test case has failed what’s wrong in my logic, please specify error and correct it

Can you please explain your approach?

the basic intuition that came to me is I am given
5 3
0 1
2 3
0 4
here I can say 0,1 ,4 are connected and they lie in one group I have marked same group by keeping parent of each node same here which is 0 (for ur clarity say A), and 2,3 are connected so it can be placed in another group so in order to show that 2 and 3 are in same group I have marked i’s parent t with group 2 (for ur clarity say B)so making say now in how many ways road can be constructid between these two gropus i.e. basic combination
no. of elements in group A X no. elements in group B i.e. 3X 2 = 6, this is my approach
now please correct my code

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.