1
0
Fork 0

Update trees/quick_union.cc

Signed-off-by: subcrip <contact@subc.rip>
This commit is contained in:
subcrip 2024-04-24 12:33:14 +08:00
parent 9a8c1277fb
commit a053db4b9b
1 changed files with 1 additions and 0 deletions

View File

@ -13,6 +13,7 @@ public:
} }
void merge(size_t i, size_t j) { void merge(size_t i, size_t j) {
if (connected(i, j)) return;
sz[query(j)] += sz[query(i)]; sz[query(j)] += sz[query(i)];
c[query(i)] = query(j); c[query(i)] = query(j);
} }