Disjoint set union (DSU)
DisJoint set union : It is a technique in graphs used for grouping problems There are two functions used (find and union ) Find: find parent; Union: merge two groups with a rule; public int find(int x,int[] par){ if(par[x]==x){ return x; } par[x]=find(par[x],par); return par[x]; }...