Disjoint Set Union FInd Algorithm

Here is my code to the link…
https://ide.codingblocks.com/s/267624
My output is coming wrong which is 9 but it is 6 according to the given lecture.