Online Judge | Problem Set | Authors | Online Contests | User | ||||||
---|---|---|---|---|---|---|---|---|---|---|
Web Board Home Page F.A.Qs Statistical Charts | Current Contest Past Contests Scheduled Contests Award Contest |
kruscal求最小生成树的最大边用快排加并查集实现。用快排实现将所有边递增,在排序的基础上每次对当前的边判断是否与前边的边构成回路,这可以用并查集实现,若当前边的两个端点不在同一集合,则可以将之加入。最终第n-1条边即为本题所求。 Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator