前言:最近快到FDS考试了,po重刷了一下学校的题目,自己整理了一些解析orz 因为po在自己找解析和学习的过程中非常痛苦,所以在此共享一下我的题目和自己写的解题思路,欢迎各位指出错误~全章节预计会陆续更新,可在专栏查看~
HW7
1. In Union/Find algorithm, if Unions are done by size, the depth of any node must be no more than N/2, but not O(logN).
F 深度最大为(log2N)+1。
2. The array representation of a disjoint set(不相交集) containing numbers 0 to 8 is given by { 1, -4, 1, 1, -3, 4, 4, 8, -2 }. Then to union the two sets which contain 6 and 8 (with union-by-size), the index of the resu

文章讲述了并查集算法中的关键概念,如深度限制(深度不超过N/2+1),如何通过union-by-size合并集合(例:6和8的合并),以及reflexive关系的定义。还讨论了树的高度与节点数量的关系。
最低0.47元/天 解锁文章
763





