int find(int x){ int temp=x; while(temp!=d[temp]) temp=d[temp]; while(x!=d[x]){ x=d[x]; d[x]=temp; } return temp; }
并查集压缩路径非递归写法
猜你喜欢
转载自www.cnblogs.com/war1111/p/12526682.html
今日推荐
周排行