数据结构英文习题解析-第七章 并查集 Union & Find

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

前言:最近快到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

评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值