Skip to content

Instantly share code, notes, and snippets.

@asutoshgha
Last active September 12, 2020 15:21
Show Gist options
  • Save asutoshgha/142e0c93ed072c81b1637b72e8de26d3 to your computer and use it in GitHub Desktop.
Save asutoshgha/142e0c93ed072c81b1637b72e8de26d3 to your computer and use it in GitHub Desktop.
disjointsetwithpathcompression
int parent[1000];
void make_set(int v){
parent[v]=v;
}
int findset(int v){
if(v == parent[v])
return v;
return parent[v]=findset(parent[v]);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment