Quick union example
index | 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 |
---|---|---|---|---|---|---|---|---|---|---|
id | 1 | 1 | 1 | 8 | 3 | 0 | 5 | 1 | 8 | 8 |
id | 0 | 1 | 2 | 3 | 4 |
---|---|---|---|---|---|
id | 1 | 2 | 3 | 4 | 4 |
O(n^2) runtime if unioning linear items.
Weighted union example
id | 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 |
---|---|---|---|---|---|---|---|---|---|---|
id | 6 | 2 | 6 | 4 | 4 | 6 | 6 | 2 | 4 | 4 |
CORRECTION: 0 should be the root.
CORRECTION: