MCPcopy Create free account
hub / github.com/ShahjalalShohag/code-library / find

Method find

Data Structures/Persistent UnionFind.cpp:80–86  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

78 c.resize(q + 1, n); cur = 0; // initial DSU is the 0th one
79 }
80 int find(int r, int u) {
81 int p = par.get_val(r, u);
82 if (p == u) return u;
83 int cur = find(r, p);
84 par.set(r, u, cur);
85 return cur;
86 }
87 bool same(int r, int u, int v) { return find(r, u) == find(r, v); }
88 int get_size(int r, int u) { return sz.get_val(r, find(r, u)); }
89 int count(int r) { return c[r]; } //connected components

Callers

nothing calls this directly

Calls 3

findFunction · 0.85
get_valMethod · 0.45
setMethod · 0.45

Tested by

no test coverage detected