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

Function unionn

CPP/graph_tree/Kruskal-Algo.cpp:23–36  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

21}
22
23void unionn(int u, int v, vector<int> &parent, vector<int> &rank) {
24 u = findPar(u, parent);
25 v = findPar(v, parent);
26 if(rank[u] < rank[v]) {
27 parent[u] = v;
28 }
29 else if(rank[v] < rank[u]) {
30 parent[v] = u;
31 }
32 else {
33 parent[v] = u;
34 rank[u]++;
35 }
36}
37int main(){
38 int N=5,m=6;
39 vector<node> edges;

Callers 1

mainFunction · 0.70

Calls 1

findParFunction · 0.85

Tested by

no test coverage detected