赞
踩
前言:最近快到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 resulting root and the value stored at the root are:
A.1 and -6
B.4 and -5
C.8 and -5
D.8 and -6
B;注意并查集的表示方法;把小的集合合并在大的集合上
3. A relation R is defined on a set S. If for every element e in S, "e R e" is always true, then R is said to be __ over S.
A.consistent
B.symmetric
C.transitive
D.reflexive
D
(Reflexive自反性) a R a, for all a ∈ S.
(Symmetric) a R b if and only if b R a.
(Transitive) a R b and b R c implies that a R c.
4.Let T be a tree created by union-by-size with N nodes, then the height of T can be .
A.at most log2(N)+1
B.at least log2(N)+1
C.as large as N
D.anything that is greater than 1
A;见题2
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。