tjdgns9246   7년 전

서로소 집합에서 간단한 개념을 이용한 합집합 연산 simpleUnion()

서로소 집합에서 간단한 개념을 이용한 찾기 연산 simpleFind()

서로소 집합에서 가중법칙을 이용한 합집합 연산 weightedUnion()

서로소 집합에서 붕괴법칙을 이용한 찾기 연산 collapsingFind()



출처



출처


<input>

8


<output>

Enter the size of disjoint-set : 8


Test for simple union & find :

1 a

2 b

3 c

4 d

5 e

6 f

7 g

-1 h

-----------------


Test for weighted union & collapsing find :

0 b

-----------------

2 d

0 c

-----------------

4 f

0 e

-----------------

6 h

4 g

0 e

-----------------

After collapsing :

0 b

-----------------

0 d

-----------------

0 f

-----------------

0 h

-----------------

댓글을 작성하려면 로그인해야 합니다.