MCPcopy Create free account
hub / github.com/codemistic/Data-Structures-and-Algorithms / find

Function find

disjoint set - Copy/code.cpp:12–20  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

10const int inf = 1e9 + 7;
11
12int find(vector<int> &parent, int x)
13{
14 if (parent[x] == x)
15 {
16 return x;
17 }
18 parent[x] = find(parent, parent[x]);
19 return parent[x];
20}
21
22void union_num(vector<int> &parent, vector<int> &rank, int num1, int num2)
23{

Callers 2

union_numFunction · 0.70
solveFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected