summaryrefslogtreecommitdiff
path: root/core/math/disjoint_set.h
diff options
context:
space:
mode:
Diffstat (limited to 'core/math/disjoint_set.h')
-rw-r--r--core/math/disjoint_set.h5
1 files changed, 2 insertions, 3 deletions
diff --git a/core/math/disjoint_set.h b/core/math/disjoint_set.h
index 32b9875e4c..198f46e111 100644
--- a/core/math/disjoint_set.h
+++ b/core/math/disjoint_set.h
@@ -41,7 +41,6 @@
/* This DisjointSet class uses Find with path compression and Union by rank */
template <typename T, class C = Comparator<T>, class AL = DefaultAllocator>
class DisjointSet {
-
struct Element {
T object;
Element *parent = nullptr;
@@ -103,7 +102,6 @@ typename DisjointSet<T, C, AL>::Element *DisjointSet<T, C, AL>::insert_or_get(T
template <typename T, class C, class AL>
void DisjointSet<T, C, AL>::create_union(T a, T b) {
-
Element *x = insert_or_get(a);
Element *y = insert_or_get(b);
@@ -111,8 +109,9 @@ void DisjointSet<T, C, AL>::create_union(T a, T b) {
Element *y_root = get_parent(y);
// Already in the same set
- if (x_root == y_root)
+ if (x_root == y_root) {
return;
+ }
// Not in the same set, merge
if (x_root->rank < y_root->rank) {