Code
Hub
Workspaces
Following
Trending
Connect
MCP
copy
Create free account
hub
/
github.com/SuprDewd/CompetitiveProgramming
/ find
Method
find
code/data-structures/union_find.cpp:3–3 ·
view source on GitHub ↗
Source
from the content-addressed store, hash-verified
1
struct union_find {
2
vi p; union_find(int n) : p(n, -1) { }
3
int find(int x) { return p[x] < 0 ? x : p[x] = find(p[x]); }
4
bool unite(int x, int y) {
5
int xp = find(x), yp = find(y);
6
if (xp == yp) return false;
Callers
nothing calls this directly
Calls
1
find
Function · 0.85
Tested by
no test coverage detected