Skip to content

Commit 1bac896

Browse files
authored
Update Union_Find.cpp
1 parent ec518b1 commit 1bac896

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

Union_Find.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ struct UF {
66
FOR(i, 0, n) arr[i] = i, sz[i] = 1;
77
}
88
int find(int x) {
9-
return (arr[x] == x) ? x : x = find(arr[x]);
9+
return (arr[x] == x) ? x : arr[x] = find(arr[x]);
1010
}
1111
void merge(int a, int b) {
1212
a = find(a), b = find(b);

0 commit comments

Comments
 (0)