标签:length span 快速 turn quick == bool color find
1 public class UfArray implements UF { 2 private int array[]=null; 3 public UfArray(int n) { 4 array=new int[n]; 5 for(int i=0;i<array.length;i++){ 6 array[i]=i; 7 } 8 } 9 10 public void union(int p, int q) { 11 12 int a=array[p]; 13 int b=array[q]; 14 15 16 for(int j=0;j<array.length;j++){ 17 if(array[j]==a) 18 array[j]=b; 19 } 20 } 21 22 23 public boolean connected(int p, int q) { 24 return array[p]==array[q]; 25 } 26 }
标签:length span 快速 turn quick == bool color find
原文地址:https://www.cnblogs.com/lIllIll/p/12154540.html