2014年4月11日

poj2524 解题报告

摘要: 基于并查集的一道简单题目Ubiquitous ReligionsTime Limit:5000MSMemory Limit:65536KTotal Submissions:22334Accepted:10996DescriptionThere are so many different religions in the world today that it is difficult to keep track of them all. You are interested in finding out how many different religions students in your 阅读全文

posted @ 2014-04-11 10:59 horizon.qiang 阅读(171) 评论(0) 推荐(0) 编辑

poj1611 解题报告

摘要: 并查集学习过之后做了几道相关联系,这里贴出1611The SuspectsTime Limit:1000MSMemory Limit:20000KTotal Submissions:20494Accepted:9940DescriptionSevere acute respiratory syndrome (SARS), an atypical pneumonia of unknown aetiology, was recognized as a global threat in mid-March 2003. To minimize transmission to others, the b 阅读全文

posted @ 2014-04-11 10:46 horizon.qiang 阅读(395) 评论(0) 推荐(0) 编辑

并查集详解

摘要: 最近回顾了一下最小生成树,发现以前学的太浅了。。。没有仔细分析其中的每一步,汗颜。。发现Kruskal算法可以用到并查集的东西,就把并查集重新温习了一下。注:这里有部分内容来自网络,有部分内容在算法导论(第二版21章)中也有。 并查集 并查集是一种树形结构,又叫“不相交集合”,保持了一组不相交的动态集合,每个集合通过一个代表来识别,代表即集合中的某个成员,通常选择根做这个代表。 三种主要操作:Make_Set(x):建立一个新的集合,其唯一成员就是x,因此这个集合的代表也是x,并查集要求各集合是不相交的,因此要求x没有在其他集合中出现过。Find_Set(x):返回能代表x所在集... 阅读全文

posted @ 2014-04-11 10:37 horizon.qiang 阅读(11407) 评论(2) 推荐(0) 编辑

导航