Disjointset union


can u tell me what is the mistake in my code

hello @Pranav7g
what issue u r facing?

check now ->

this issue was with the size.

ur code is accessing V th index , but the parent array size is V…
make it V+1 and it will work fine