From a9bc65e2c871db1d786f718f6e92ad3921006fdb Mon Sep 17 00:00:00 2001 From: Anthony Wang Date: Sat, 5 Sep 2020 17:17:25 -0500 Subject: Update union-find_disjoint_set.cpp --- Data Structures/union-find_disjoint_set.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Data Structures/union-find_disjoint_set.cpp b/Data Structures/union-find_disjoint_set.cpp index b47139f..0ffee07 100644 --- a/Data Structures/union-find_disjoint_set.cpp +++ b/Data Structures/union-find_disjoint_set.cpp @@ -2,9 +2,9 @@ class UFDS { private: vector p, rank; public: UFDS(int N) { - p.assign(N + 1, 0); + p.assign(N+1, 0); for (int i = 0; i <= N; i++) p[i] = i; - rank.assign(N + 1, 0); + rank.assign(N+1, 0); } int find_set(int i) { return (p[i] == i) ? i : (p[i] = find_set(p[i])); } bool same_set(int i, int j) { return find_set(i) == find_set(j); } @@ -14,4 +14,4 @@ public: rank[x] > rank[y] ? p[y] = x : p[x] = y; if (rank[x] == rank[y]) rank[y]++; } -}; \ No newline at end of file +}; -- cgit v1.2.3-70-g09d2