Algorithm quick-find
Initialize
union ( a, b )
i = V[ a ]
j = V[ b ]
For each element i of V
v[ i ] * V[ a ] => v[ i ] = j
| Index | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 |
|---|---|---|---|---|---|---|---|---|
| group | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 |
![]() |
union( 2 ,6 )
union ( a=2, b=6 )
i = V[ 2 ] => i = 2
j = V[ 6 ] => j = 6
For each element i of V
v[ i ] * 2 => v[ i ] = 6
| Index | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 |
|---|---|---|---|---|---|---|---|---|
| group | 1 | 6 | 3 | 4 | 5 | 6 | 7 | 8 |
![]() |
union( 4, 8 )
union ( a=4, b=8 )
i = V[ 4 ] => i = 4
j = V[ 8 ] => j = 8
For each element i of V
v[ i ] * 4 => v[ i ] = 8
| Index | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 |
|---|---|---|---|---|---|---|---|---|
| group | 1 | 6 | 3 | 8 | 5 | 6 | 7 | 8 |
![]() |
union( 8, 3 )
union ( a=8, b=3 )
i = V[ 8 ] => i = 8
j = V[ 3 ] => j = 3
For each element i of V
V[ i ] * 8 => v[ i ] = 3
| Index | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 |
|---|---|---|---|---|---|---|---|---|
| group | 1 | 6 | 3 | 3 | 5 | 6 | 7 | 3 |
![]() |
union( 1, 2 )
union ( a=1, b=2 )
i = V[ 1 ] => i = 1
j = V[ 2 ] => j = 6
For each element i of V
V[ i ] * 1 => v[ i ] = 6
| Index | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 |
|---|---|---|---|---|---|---|---|---|
| group | 6 | 6 | 3 | 3 | 5 | 6 | 7 | 3 |
![]() |
union( 7, 5 )
union ( a=7, b=5 )
i = V[ 7 ] => i = 7
j = V[ 5 ] => j = 5
For each element i of V
v[ i ] * 7 => v[ i ] = 5
| Index | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 |
|---|---|---|---|---|---|---|---|---|
| group | 6 | 6 | 3 | 3 | 5 | 6 | 5 | 3 |
] |
union( 1, 5 )
union ( a, b )
i = V[ 1 ] => i = 6
j = V[ 5 ] => j = 5
For each element i of V
v[ i ] * 6 => v[ i ] = 5
| Index | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 |
|---|---|---|---|---|---|---|---|---|
| group | 5 | 5 | 3 | 3 | 5 | 5 | 5 | 3 |
![]() |
union( 5, 3 )
union ( a=5, b=3 )
i = V[ 5 ] => i = 5
j = V[ 3 ] => j = 3
For each element i of V
v[ i ] * 5 => v[ i ] = 3
| Index | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 |
|---|---|---|---|---|---|---|---|---|
| group | 3 | 3 | 3 | 3 | 3 | 3 | 3 | 3 |
![]() |
.png)
.png)
.png)
.png)
.png)
].png)
.png)